Re: [PATCH] hwmon: (dimmtemp) Fix bitmap handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2022-05-17 at 13:17 -0700, Guenter Roeck wrote:
> Building arm:allmodconfig may fail with the following error.
> 
> In function 'fortify_memcpy_chk',
>     inlined from 'bitmap_copy' at include/linux/bitmap.h:261:2,
>     inlined from 'bitmap_copy_clear_tail' at include/linux/bitmap.h:270:2,
>     inlined from 'bitmap_from_u64' at include/linux/bitmap.h:622:2,
>     inlined from 'check_populated_dimms' at
>         drivers/hwmon/peci/dimmtemp.c:284:2:
> include/linux/fortify-string.h:344:25: error:
>         call to '__write_overflow_field' declared with attribute warning:
>         detected write beyond size of field (1st parameter)
> 
> The problematic code is
>         bitmap_from_u64(priv->dimm_mask, dimm_mask);
> 
> dimm_mask is declared as u64, but the bitmap in priv->dimm_mask is only
> 24 bit wide. On 32-bit systems, this results in writes over the end of
> the bitmap.
> 
> Fix the problem by using u32 instead of u64 for dimm_mask. This is
> currently sufficient, and a compile time check to ensure that the number
> of dimms does not exceed the bit map size is already in place.
> 
> Fixes: 73bc1b885dae ("hwmon: peci: Add dimmtemp driver")
> Cc: Iwona Winiarska <iwona.winiarska@xxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

Reviewed-by: Iwona Winiarska <iwona.winiarska@xxxxxxxxx>

Thanks
-Iwona

> ---
>  drivers/hwmon/peci/dimmtemp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux