]> git.baikalelectronics.ru Git - kernel.git/commit
Staging: iio/accel: Changed data type of val in store_measurement_mode to u8
authorAndreas Ruprecht <rupran@einserver.de>
Sun, 27 Nov 2011 22:17:42 +0000 (23:17 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 29 Nov 2011 01:12:06 +0000 (10:12 +0900)
commita5d6463c79fc571151a37ce2aa6f08d8b5a457f4
treeb9e2fd6b22e5ec186badbfb9f3d8df23a295cd80
parent38e9bd51d9fdaadc3271b1579b2304cacf6b179b
Staging: iio/accel: Changed data type of val in store_measurement_mode to u8

The code in sca3000_store_measurement_mode() uses the variable val to
do bitwise operations with an int mask and or-s it into st->rx[0] which
is an entry in a u8 array (see sca3000.h).

This means up to now values larger than a u8 were silently ignored and
just the lower 8 bits counted into the value that was written into
st->rx[0]. This code will return -ERANGE if the value in buf was too
large to fit into a u8.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/iio/accel/sca3000_core.c