Re: [PATCH] hv_netvsc: Add check for kvmalloc_array

From: Jiasheng Jiang
Date: Thu Mar 10 2022 - 22:21:22 EST


On Fri, 11 Mar 2022 11:00:24 +0800
Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx> wrote:
>> + if (!pcpu_sum) {
>> + for (j = 0; j < i; j++)
>> + data[j] = 0;
>> + return
>
> Why is unrolled zero (memset) needed? The data area comes from
> ethtool_get_stats and is already zeroed (vzalloc).
>
>
> There does look like at TOCTOU error here with on the number of stats.
> Code doesn't look hotplug safe.
> Not sure, but that issue might have been raised during review.

I unrolled the 'data area' since the three 'for loops' before
have already assigned the value to the data area.
And I have not found any review about it.

Thanks,
Jiang