Build warning in cros_ec_sensors_ring |
|||
Issue description
Reported by 0day:
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_ring.c: In function 'cros_ec_ring_event':
>> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_ring.c:356:33: warning: 'current_timestamp' may be used uninitialized in this function [-Wmaybe-uninitialized]
state->fifo_timestamp[LAST_TS] = current_timestamp;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_ring.c:174:25: note: 'current_timestamp' was declared here
s64 fifo_timestamp, current_timestamp;
^~~~~~~~~~~~~~~~~
The underlying problem is a goto to the end of the affected function without initializing (but using) current_timestamp, and without releasing an acquired mutex.
,
Dec 1 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/bc3e01dbdcd99a3ad163317c0bf2968b150913dd commit bc3e01dbdcd99a3ad163317c0bf2968b150913dd Author: Guenter Roeck <groeck@chromium.org> Date: Fri Dec 01 06:40:03 2017 FIXUP: CHROMIUM: iio: cros_ec: add support for single sensor hub FIFO 0day reports: drivers/iio/common/cros_ec_sensors/cros_ec_sensors_ring.c: In function 'cros_ec_ring_event': >> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_ring.c:356:33: warning: >> 'current_timestamp' may be used uninitialized in this function The warning actually reveals a worse problem: the code is reached from a goto statement which leaves a mutex locked. BUG= chromium:790771 TEST=Build and observe lack of warning Change-Id: Ic448c7b4caf4b9889638eb3f74f99dfd4d8b1e87 Signed-off-by: Guenter Roeck <groeck@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/802246 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> [modify] https://crrev.com/bc3e01dbdcd99a3ad163317c0bf2968b150913dd/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_ring.c
,
Dec 1 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by groeck@chromium.org
, Nov 30 2017