hwmon: (ads1015) Fix out-of-bounds array access
authorAxel Lin <axel.lin@ingics.com>
Tue, 5 Aug 2014 01:59:49 +0000 (09:59 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 6 Aug 2014 00:49:01 +0000 (17:49 -0700)
commite981429557cbe10c780fab1c1a237cb832757652
tree10d9b16dbdbc5fed5d55b5474e1422d2fcb094c7
parent5b963089161b8fb244889c972edf553b9d737545
hwmon: (ads1015) Fix out-of-bounds array access

Current code uses data_rate as array index in ads1015_read_adc() and uses pga
as array index in ads1015_reg_to_mv, so we must make sure both data_rate and
pga settings are in valid value range.
Return -EINVAL if the setting is out-of-range.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ads1015.c