hwmon: (ads1015) Fix off-by-one for valid channel index checking
PATCH 1/1 hwmon: (ads1015) Fix off-by-one for valid channel index checking
Current code uses channel as array index, so the valid channel value is 0 .. ADS1015_CHANNELS - 1.
--- drivers/hwmon/ads1015.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/ads1015.c +1 -1
@@ -198,7 +198,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) } channel =be32_to_cpup (property); -if (channel >ADS1015_CHANNELS ) { +if (channel >=ADS1015_CHANNELS ) {dev_err (&client->dev,"invalid channel index %d on %s\n" , channel, node->full_name);
Signature · 9 lines
1.9.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 4 lines · Axel Lin
Current code uses channel as array index, so the valid channel value is 0 ..
ADS1015_CHANNELS- 1.Signed-off-by Axel Lin <[email protected]>
Amazing. How do you find this stuff ?
Applied.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
2014-07-30 11:28 GMT+08:00 Guenter Roeck <[email protected]>:
Quoted 9 lines · Axel Lin
Quoted 5 lines
Current code uses channel as array index, so the valid channel value is 0 ..
ADS1015_CHANNELS- 1.Signed-off-by Axel Lin <[email protected]>Amazing. How do you find this stuff ?
I just read the code. :-)
Axel
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors