Messages in this thread | | | Date | Thu, 9 Dec 2021 10:25:15 -0500 | From | Steven Rostedt <> | Subject | Re: [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
| |