[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211130144300.GA269056@roeck-us.net>
Date: Tue, 30 Nov 2021 06:43:00 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Eugene Shalygin <eugene.shalygin@...il.com>,
Denis Pauk <pauk.denis@...il.com>,
Jean Delvare <jdelvare@...e.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2] hwmon: (asus_wmi_ec_sensors) fix array overflow
On Tue, Nov 30, 2021 at 01:50:34PM +0300, Dan Carpenter wrote:
> Smatch detected an array out of bounds error:
>
> drivers/hwmon/asus_wmi_ec_sensors.c:562 asus_wmi_ec_configure_sensor_setup()
> error: buffer overflow 'hwmon_attributes' 8 <= 9
>
> The hwmon_attributes[] array needs to be declared with "hwmon_max"
> elements.
>
> Fixes: c04c7f7bfcbe ("hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/asus_wmi_ec_sensors.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/asus_wmi_ec_sensors.c b/drivers/hwmon/asus_wmi_ec_sensors.c
> index f612abc66c89..22a1459305a7 100644
> --- a/drivers/hwmon/asus_wmi_ec_sensors.c
> +++ b/drivers/hwmon/asus_wmi_ec_sensors.c
> @@ -41,7 +41,7 @@
> #define ASUSWMI_MAX_BUF_LEN 128
> #define SENSOR_LABEL_LEN 16
>
> -static u32 hwmon_attributes[] = {
> +static u32 hwmon_attributes[hwmon_max] = {
> [hwmon_chip] = HWMON_C_REGISTER_TZ,
> [hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL,
> [hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL,
Powered by blists - more mailing lists