mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
iio: imu: bno055: uninitialized variable bug in bno055_trigger_handler()
This bug is basically harmless, although it will trigger a runtime warning
if you use KMSan. On the first iteration through the loop, the
"best_delta" variable is uninitialized so re-order the condition to
prevent reading uninitialized memory.
Fixes: 4aefe1c2bd
("iio: imu: add Bosch Sensortec BNO055 core driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/Y0kuaO9PQkSQja+A@kili
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
65f2030160
commit
dd4753f88f
@ -632,7 +632,7 @@ static int bno055_set_regmask(struct bno055_priv *priv, int val, int val2,
|
||||
return -EINVAL;
|
||||
}
|
||||
delta = abs(tbl_val - req_val);
|
||||
if (delta < best_delta || first) {
|
||||
if (first || delta < best_delta) {
|
||||
best_delta = delta;
|
||||
hwval = i;
|
||||
first = false;
|
||||
|
Loading…
Reference in New Issue
Block a user