New issue
Advanced search Search tips

Issue 790771 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

Build warning in cros_ec_sensors_ring

Project Member Reported by groeck@chromium.org, Nov 30 2017

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.

 

Comment 1 by groeck@chromium.org, Nov 30 2017

Labels: Kernel-4.14
Project Member

Comment 2 by bugdroid1@chromium.org, Dec 1 2017

Labels: merge-merged-chromeos-4.14
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

Status: Fixed (was: Assigned)

Sign in to add a comment