Re: [PATCH v2] smp: Fix a potential usage of stale nr_cpus

From: Thomas Gleixner
Date: Sun Jul 19 2020 - 08:13:09 EST


Muchun Song <songmuchun@xxxxxxxxxxxxx> writes:

> When the cmdline of "nr_cpus" is not valid, the @nr_cpu_ids is assigned
> a stale value. The nr_cpus is only valid when get_option() return 1. So
> check the return value to prevent this.
>
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> ---
> changelog in v2:
> 1) Rework the commit log.
> 2) Rework the return value check.

I asked:

>> So why fixing it just half and why returning '0' aka success if the
>> parameter is bogus?

And this still returns 0 if the parameter is bogus or malformatted....

Thanks,

tglx