[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211209102515.3f5af7f5@gandalf.local.home>
Date: Thu, 9 Dec 2021 10:25:15 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched/uclamp: potential dereference of null pointer
On Thu, 9 Dec 2021 10:23:13 -0500
Steven Rostedt <rostedt@...dmis.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
Powered by blists - more mailing lists