https://github.com/torvalds/linux
Revision d70674eeaa5efdefb99928691161578ae0a80316 authored by Arnd Bergmann on 25 October 2016, 15:55:04 UTC, committed by Greg Kroah-Hartman on 13 November 2016, 09:08:32 UTC
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: 231147ee77f3 ("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 32cb7d27e65df9daa7cee8f1fdf7b259f214bee2)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 68fae2f
History
Tip revision: d70674eeaa5efdefb99928691161578ae0a80316 authored by Arnd Bergmann on 25 October 2016, 15:55:04 UTC
iio: maxim_thermocouple: detect invalid storage size in read()
Tip revision: d70674e
File Mode Size
Kconfig -rw-r--r-- 3.7 KB
Makefile -rw-r--r-- 685 bytes
font_10x18.c -rw-r--r-- 140.6 KB
font_6x10.c -rw-r--r-- 60.8 KB
font_6x11.c -rw-r--r-- 66.6 KB
font_7x14.c -rw-r--r-- 79.1 KB
font_8x16.c -rw-r--r-- 93.7 KB
font_8x8.c -rw-r--r-- 49.7 KB
font_acorn_8x8.c -rw-r--r-- 15.7 KB
font_mini_4x6.c -rw-r--r-- 54.6 KB
font_pearl_8x8.c -rw-r--r-- 54.4 KB
font_sun12x22.c -rw-r--r-- 181.5 KB
font_sun8x16.c -rw-r--r-- 22.1 KB
fonts.c -rw-r--r-- 3.0 KB

back to top