linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/gatt: Fix possible NULL dereference
Date: Fri, 19 Dec 2014 14:10:06 +0100	[thread overview]
Message-ID: <1449847.FzcL4bpd4a@uw000953> (raw)
In-Reply-To: <1418992228-4070-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Friday 19 of December 2014 14:30:28 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Fixes warnings:
> ...
> Pointer 'req' returned from call to function 'queue_peek_head'
> may be NULL and will be dereferenced
> ...
> ---
>  android/gatt.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index 6828f2f..2534836 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -5561,6 +5561,9 @@ static void handle_server_send_response(const void *buf, uint16_t len)
>  		 * gatt_db_attribute_write().
>  		 */
>  		req = queue_peek_head(conn->device->pending_requests);
> +		if (!req)
> +			goto done;
> +
>  		/* Cast status to uint8_t, due to (byte) cast in java layer. */
>  		req->error = err_to_att((uint8_t) cmd->status);
>  		req->state = REQUEST_DONE;
> 

Patch applied, thanks.

-- 
Best regards, 
Szymon Janc

      reply	other threads:[~2014-12-19 13:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 12:30 [PATCH] android/gatt: Fix possible NULL dereference Andrei Emeltchenko
2014-12-19 13:10 ` Szymon Janc [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=1449847.FzcL4bpd4a@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=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;
as well as URLs for NNTP newsgroup(s).