From: "Winiarska, Iwona" <iwona.winiarska@intel.com>
To: "linux@roeck-us.net" <linux@roeck-us.net>,
"zev@bewilderbeest.net" <zev@bewilderbeest.net>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
"jdelvare@suse.com" <jdelvare@suse.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"stable@kernel.org" <stable@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"pierre-louis.bossart@linux.intel.com"
<pierre-louis.bossart@linux.intel.com>,
"jae.hyun.yoo@linux.intel.com" <jae.hyun.yoo@linux.intel.com>,
"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>
Subject: Re: [PATCH] hwmon: (peci/cputemp) Fix off-by-one in coretemp_label allocation
Date: Fri, 3 Feb 2023 00:01:30 +0000 [thread overview]
Message-ID: <c4b9beb89c62c35fa6ae81b78f6f8243c5a4e4aa.camel@intel.com> (raw)
In-Reply-To: <20230202021825.21486-1-zev@bewilderbeest.net>
On Wed, 2023-02-01 at 18:18 -0800, Zev Weiss wrote:
> The find_last_bit() call produces the index of the highest-numbered
> core in core_mask; because cores are numbered from zero, the number of
> elements we need to allocate is one more than that.
>
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> Cc: stable@kernel.org # v5.18
> Fixes: bf3608f338e9 ("hwmon: peci: Add cputemp driver")
Thanks for catching it.
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
> ---
> drivers/hwmon/peci/cputemp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/peci/cputemp.c b/drivers/hwmon/peci/cputemp.c
> index ec9851daf2e8..f13cc4170f58 100644
> --- a/drivers/hwmon/peci/cputemp.c
> +++ b/drivers/hwmon/peci/cputemp.c
> @@ -431,7 +431,7 @@ static int create_temp_label(struct peci_cputemp *priv)
> unsigned long core_max = find_last_bit(priv->core_mask,
> CORE_NUMS_MAX);
> int i;
>
> - priv->coretemp_label = devm_kzalloc(priv->dev, core_max * sizeof(char
> *), GFP_KERNEL);
> + priv->coretemp_label = devm_kzalloc(priv->dev, (core_max + 1) *
> sizeof(char *), GFP_KERNEL);
> if (!priv->coretemp_label)
> return -ENOMEM;
>
next prev parent reply other threads:[~2023-02-03 0:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 2:18 Zev Weiss
2023-02-03 0:01 ` Winiarska, Iwona [this message]
2023-02-03 15:27 ` Guenter Roeck
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=c4b9beb89c62c35fa6ae81b78f6f8243c5a4e4aa.camel@intel.com \
--to=iwona.winiarska@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jae.hyun.yoo@linux.intel.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=openbmc@lists.ozlabs.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=stable@kernel.org \
--cc=zev@bewilderbeest.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
all inboxes | Powered by JetHome®