Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/mcap: Fix possible uninitialized use
Date: Thu, 26 Jun 2014 17:05:11 +0300	[thread overview]
Message-ID: <20140626140509.GC11076@aemeltch-MOBL1> (raw)
In-Reply-To: <1403790332-27829-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

On Thu, Jun 26, 2014 at 04:45:32PM +0300, Andrei Emeltchenko wrote:
> 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:

Please discard this, I will rework the patch.

> 
> ...
> 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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2014-06-26 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 13:45 [PATCH] android/mcap: Fix possible uninitialized use Andrei Emeltchenko
2014-06-26 14:05 ` Andrei Emeltchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140626140509.GC11076@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox