Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: "Winiarska, Iwona" <iwona.winiarska@intel.com>
To: "linux@roeck-us.net" <linux@roeck-us.net>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>
Cc: "jdelvare@suse.com" <jdelvare@suse.com>
Subject: Re: [PATCH] hwmon: (dimmtemp) Fix bitmap handling
Date: Wed, 18 May 2022 20:54:49 +0000	[thread overview]
Message-ID: <c8948556409d38103886d96beba471aa7fc9be6a.camel@intel.com> (raw)
In-Reply-To: <20220517201740.1020831-1-linux@roeck-us.net>

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@intel.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

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

Thanks
-Iwona

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

      reply	other threads:[~2022-05-18 20:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 20:17 [PATCH] hwmon: (dimmtemp) Fix bitmap handling Guenter Roeck
2022-05-18 20:54 ` Winiarska, Iwona [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8948556409d38103886d96beba471aa7fc9be6a.camel@intel.com \
    --to=iwona.winiarska@intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox