1
0
Fork 0
alistair23-linux/drivers/iio
Arnd Bergmann d70674eeaa iio: maxim_thermocouple: detect invalid storage size in read()
As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
than 2 or 4 will result in undefined behavior:

drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This probably cannot happen, but returning -EINVAL here is appropriate
and makes gcc happy and the code more robust.

Fixes: 231147ee77 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
(cherry picked from commit 32cb7d27e6)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-13 10:08:32 +01:00
..
accel iio: st_sensors: fix scale configuration for h3lis331dl 2016-10-30 16:46:46 +00:00
adc iio: adc: ti-adc081c: Select IIO_TRIGGERED_BUFFER to prevent build errors 2016-10-09 08:45:07 +01:00
amplifiers spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
buffer iio: add resource managed triggered buffer init helpers 2016-09-04 15:42:46 +01:00
chemical iio:chemical:atlas-ph-sensor: Fix use of 32 bit int to hold 16 bit big endian value 2016-10-23 22:18:27 +01:00
common iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation. 2016-11-05 17:50:56 +00:00
dac Merge 4.8-rc5 into staging-next 2016-09-05 08:13:24 +02:00
dummy iio:core: timestamping clock selection support 2016-06-30 19:41:38 +01:00
frequency iio: frequency: ad9523: use unsigned int rather then bare unsigned 2016-04-17 10:31:03 +01:00
gyro iio: common: ssp_sensors: gyro: constify iio_info structures 2016-09-18 11:59:51 +01:00
health First round of IIO new device support, features and cleanups for the 4.8 cycle. 2016-06-09 09:15:58 -07:00
humidity Merge 4.8-rc5 into staging-next 2016-09-05 08:13:24 +02:00
imu Third set of IIO new device support, features and cleanups for the 4.8 cycle. 2016-07-14 12:05:29 +09:00
light iio: light: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors 2016-09-18 19:56:39 +01:00
magnetometer iio: magn: ak8974: remove .owner field for driver 2016-08-29 20:12:10 +01:00
orientation iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver) 2016-11-05 17:47:47 +00:00
potentiometer iio: potentiometer: Fix typo in Kconfig 2016-07-03 12:40:01 +01:00
pressure Staging/IIO patches for 4.9-rc1 2016-10-05 14:50:51 -07:00
proximity Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
temperature iio: maxim_thermocouple: detect invalid storage size in read() 2016-11-13 10:08:32 +01:00
trigger iio:trigger: Experimental kthread tight loop trigger (thread only) 2016-06-03 13:18:44 +01:00
Kconfig iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
Makefile iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
iio_core.h iio:core: timestamping clock selection support 2016-06-30 19:41:38 +01:00
iio_core_trigger.h
industrialio-buffer.c iio: ensure ret is initialized to zero before entering do loop 2016-09-05 21:00:14 +01:00
industrialio-configfs.c iio:configfs: Introduce iio/configfs.h to provide a location for the configfs_subsystem 2015-12-05 16:25:30 +00:00
industrialio-core.c Second set of iio new device support, features and cleanups for the 4.9 cycle. 2016-09-14 20:42:03 +02:00
industrialio-event.c iio: iio_push_event(): Don't crash if the event interface is not registered 2016-09-10 16:40:44 +01:00
industrialio-sw-device.c iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
industrialio-sw-trigger.c iio: core: fix ptr_ret.cocci warnings 2016-01-20 17:09:18 -08:00
industrialio-trigger.c iio: trigger: helpers to determine own trigger 2016-09-10 16:49:14 +01:00
industrialio-triggered-event.c iio: Support triggered events 2015-08-27 20:47:09 +01:00
inkern.c iio: core: Add devm_ APIs for iio_channel_{get,release}_all 2016-04-19 19:58:15 +01:00