Commit 3315e716 authored by Dan Carpenter's avatar Dan Carpenter Committed by Guenter Roeck

hwmon: (asus_wmi_sensors) fix an array overflow

Smatch detects this array overflow:

    drivers/hwmon/asus_wmi_sensors.c:569 asus_wmi_configure_sensor_setup()
    error: buffer overflow 'hwmon_attributes' 8 <= 9

The hwmon_attributes[] array should have "hwmon_max" so that it gets
larger when more attributes are added.

Fixes: 9d07e54a25b8 ("hwmon: (asus_wmi_sensors) Support X370 Asus WMI.")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211130105117.GH5827@kiliSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 34e2bd10
...@@ -125,7 +125,7 @@ static enum hwmon_sensor_types asus_data_types[] = { ...@@ -125,7 +125,7 @@ static enum hwmon_sensor_types asus_data_types[] = {
[WATER_FLOW] = hwmon_fan, [WATER_FLOW] = hwmon_fan,
}; };
static u32 hwmon_attributes[] = { static u32 hwmon_attributes[hwmon_max] = {
[hwmon_chip] = HWMON_C_REGISTER_TZ, [hwmon_chip] = HWMON_C_REGISTER_TZ,
[hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL, [hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL,
[hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL, [hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment