Skip to content
Commit 7c6fe073 authored by Keith Packard's avatar Keith Packard Committed by Stephanos Ioannidis
Browse files

drivers/adxl372: Fix computation of sensor value



Sensor value computation was creating a 64-bit integer value, passing
that to 'abs' and assigning that to an int32_t result and then sanity
checking the result. If the computation goes badly wrong, then the range
reduction of 64-bit to 32-bit values could generate a falsely in-range
value.

Instead, perform the computation in 64-bits, range check that value and
then assign to a 32-bit variable.

Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
parent 0970cda9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment