lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/uclamp: potential dereference of null pointer
On Thu, 9 Dec 2021 10:23:13 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -8125,6 +8125,8 @@ void __init sched_init(void)
> > #endif
> > if (ptr) {
> > ptr = (unsigned long)kzalloc(ptr, GFP_NOWAIT);
> > + if (!ptr)
> > + return;
>
> If this were to happen the system would crash immediately, with or without
> the return.
>
> If you are worried about not being able to allocate ptr, then the only
> reasonable fix here is
>
> BUG_ON(!ptr);
>
> That way you would know exactly why your system crashed. Because just
> returning would crash for other reasons and make it less debuggable.

And this is not worth the churn (because if it failed to allocate, you have
bigger problems to deal with).

So NAK on this change.

-- Steve

\
 
 \ /
  Last update: 2021-12-09 16:26    [W:0.022 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site