linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] android/mcap: Fix possible uninitialized use
@ 2014-06-26 13:45 Andrei Emeltchenko
  2014-06-26 14:05 ` Andrei Emeltchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-06-26 13:45 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

In case of maximum number of retries has reached, base_time may be used
uninitialized. Fixes following warnings:

...
external/bluetooth/bluez/android/mcap-lib.c: In function
'sync_send_indication.part.35':
external/bluetooth/bluez/android/mcap-lib.c:2366:20: warning:
'base_time.tv_sec' may be used uninitialized in this function
[-Wuninitialized]
external/bluetooth/bluez/android/mcap-lib.c:2693:18: note:
'base_time.tv_sec' was declared here
external/bluetooth/bluez/android/mcap-lib.c:2366:46: warning:
'base_time.tv_nsec' may be used uninitialized in this function
[-Wuninitialized]
external/bluetooth/bluez/android/mcap-lib.c:2693:18: note:
'base_time.tv_nsec' was declared here
external/bluetooth/bluez/android/mcap-lib.c: In function
'sync_send_indication':
external/bluetooth/bluez/android/mcap-lib.c:2366:20: warning:
'base_time.tv_sec' may be used uninitialized in this function
[-Wuninitialized]
external/bluetooth/bluez/android/mcap-lib.c:2693:18: note:
'base_time.tv_sec' was declared here
external/bluetooth/bluez/android/mcap-lib.c:2366:46: warning:
'base_time.tv_nsec' may be used uninitialized in this function
[-Wuninitialized]
external/bluetooth/bluez/android/mcap-lib.c:2693:18: note:
'base_time.tv_nsec' was declared here
...
---
 android/mcap-lib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/android/mcap-lib.c b/android/mcap-lib.c
index 256abe1..dd688d9 100644
--- a/android/mcap-lib.c
+++ b/android/mcap-lib.c
@@ -2663,12 +2663,12 @@ static gboolean get_all_clocks(struct mcap_mcl *mcl, uint32_t *btclock,
 		if (clock_gettime(CLK, &t0) < 0)
 			return FALSE;
 
-		if (!read_btclock(mcl, btclock, &btres))
-			continue;
-
 		if (clock_gettime(CLK, base_time) < 0)
 			return FALSE;
 
+		if (!read_btclock(mcl, btclock, &btres))
+			continue;
+
 		/*
 		 * Tries to detect preemption between clock_gettime
 		 * and read_btclock by measuring transaction time
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-26 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 13:45 [PATCH] android/mcap: Fix possible uninitialized use Andrei Emeltchenko
2014-06-26 14:05 ` Andrei Emeltchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).