Re: [PATCH V9] powercap/drivers/idle_injection: Add an idle injection framework
From: Rafael J. Wysocki
Date: Mon Jun 25 2018 - 06:00:16 EST
On Mon, Jun 25, 2018 at 11:44 AM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> On 25-06-18, 10:23, Rafael J. Wysocki wrote:
>> On Tue, Jun 19, 2018 at 3:23 PM, Daniel Lezcano
>> > +void idle_injection_get_duration(struct idle_injection_device *ii_dev,
>> > + unsigned int *run_duration_ms,
>> > + unsigned int *idle_duration_ms)
>> > +{
>> > + *run_duration_ms = READ_ONCE(ii_dev->run_duration_ms);
>> > + *idle_duration_ms = READ_ONCE(ii_dev->idle_duration_ms);
>>
>> Should you check the arguments against NULL before attempting to
>> dereference them? If not, then why not?
>
> I would vote with a NO. This is a mandatory parameter and not filling it in with
> a valid pointer is a BUG really. I don't see a reason why we should prevent the
> kernel from crashing if such a mistake happens :)
Well, fair enough.