[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aac56718-c757-6bfd-7932-b18cf7d4254d@roeck-us.net>
Date: Thu, 7 Jan 2021 22:17:12 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: "Chatradhi, Naveen Krishna" <NaveenKrishna.Chatradhi@....com>,
David Arcari <darcari@...hat.com>,
"linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>
Cc: Jean Delvare <jdelvare@...e.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH] hwmon: (amd_energy) fix allocation of hwmon_channel_info
config
On 1/7/21 9:49 PM, Chatradhi, Naveen Krishna wrote:
> [AMD Official Use Only - Approved for External Use]
>
> Hi David,
>
> Thank you for noticing and submitting a fix. You may use
> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@....com>
>
No, because you are not in the approval path (you did not send the patch
to me). Reviewed-by: or Acked-by: would be more appropriate.
Genter
> Regards,
> Naveenk
>
> -----Original Message-----
> From: David Arcari <darcari@...hat.com>
> Sent: Thursday, January 7, 2021 8:17 PM
> To: linux-hwmon@...r.kernel.org
> Cc: David Arcari <darcari@...hat.com>; Chatradhi, Naveen Krishna <NaveenKrishna.Chatradhi@....com>; Jean Delvare <jdelvare@...e.com>; Guenter Roeck <linux@...ck-us.net>; linux-kernel@...r.kernel.org; stable@...r.kernel.org
> Subject: [PATCH] hwmon: (amd_energy) fix allocation of hwmon_channel_info config
>
> [CAUTION: External Email]
>
> hwmon, specifically hwmon_num_channel_attrs, expects the config array in the hwmon_channel_info structure to be terminated by a zero entry. amd_energy does not honor this convention. As result, a KASAN warning is possible. Fix this by adding an additional entry and setting it to zero.
>
> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
>
> Signed-off-by: David Arcari <darcari@...hat.com>
> Cc: Naveen Krishna Chatradhi <nchatrad@....com>
> [naveenk:] Signed-off-by: Naveen Krishna Chatradhi <nchatrad@....com>
> Cc: Jean Delvare <jdelvare@...e.com>
> Cc: Guenter Roeck <linux@...ck-us.net>
> Cc: linux-kernel@...r.kernel.org
> Cc: stable@...r.kernel.org
> ---
> drivers/hwmon/amd_energy.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index 9b306448b7a0..822c2e74b98d 100644
> --- a/drivers/hwmon/amd_energy.c
> +++ b/drivers/hwmon/amd_energy.c
> @@ -222,7 +222,7 @@ static int amd_create_sensor(struct device *dev,
> */
> cpus = num_present_cpus() / num_siblings;
>
> - s_config = devm_kcalloc(dev, cpus + sockets,
> + s_config = devm_kcalloc(dev, cpus + sockets + 1,
> sizeof(u32), GFP_KERNEL);
> if (!s_config)
> return -ENOMEM;
> @@ -254,6 +254,7 @@ static int amd_create_sensor(struct device *dev,
> scnprintf(label_l[i], 10, "Esocket%u", (i - cpus));
> }
>
> + s_config[i] = 0;
> return 0;
> }
>
> --
> 2.18.1
>
Powered by blists - more mailing lists