lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c4b9beb89c62c35fa6ae81b78f6f8243c5a4e4aa.camel@intel.com>
Date:   Fri, 3 Feb 2023 00:01:30 +0000
From:   "Winiarska, Iwona" <iwona.winiarska@...el.com>
To:     "linux@...ck-us.net" <linux@...ck-us.net>,
        "zev@...ilderbeest.net" <zev@...ilderbeest.net>
CC:     "linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>,
        "jdelvare@...e.com" <jdelvare@...e.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "stable@...nel.org" <stable@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "pierre-louis.bossart@...ux.intel.com" 
        <pierre-louis.bossart@...ux.intel.com>,
        "jae.hyun.yoo@...ux.intel.com" <jae.hyun.yoo@...ux.intel.com>,
        "openbmc@...ts.ozlabs.org" <openbmc@...ts.ozlabs.org>
Subject: Re: [PATCH] hwmon: (peci/cputemp) Fix off-by-one in coretemp_label
 allocation

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@...ilderbeest.net>
> Cc: stable@...nel.org # v5.18
> Fixes: bf3608f338e9 ("hwmon: peci: Add cputemp driver")

Thanks for catching it.

Reviewed-by: Iwona Winiarska <iwona.winiarska@...el.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;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ