Skip to content

Commit a2125d0

Browse files
arndbgroeck
authored andcommitted
hwmon: (asus_atk0110) fix uninitialized data access
The latest gcc-7 snapshot adds a warning to point out that when atk_read_value_old or atk_read_value_new fails, we copy uninitialized data into sensor->cached_value: drivers/hwmon/asus_atk0110.c: In function 'atk_input_show': drivers/hwmon/asus_atk0110.c:651:26: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized] Adding an error check avoids this. All versions of the driver are affected. Fixes: 2c03d07 ("hwmon: Add Asus ATK0110 support") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Luca Tettamanti <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent a5023a9 commit a2125d0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/hwmon/asus_atk0110.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,9 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value)
646646
else
647647
err = atk_read_value_new(sensor, value);
648648

649+
if (err)
650+
return err;
651+
649652
sensor->is_valid = true;
650653
sensor->last_updated = jiffies;
651654
sensor->cached_value = *value;

0 commit comments

Comments
 (0)