* [PATCH] android/gatt: Fix possible NULL dereference
@ 2014-12-19 12:30 Andrei Emeltchenko
2014-12-19 13:10 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-12-19 12:30 UTC (permalink / raw)
To: linux-bluetooth
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;
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] android/gatt: Fix possible NULL dereference
2014-12-19 12:30 [PATCH] android/gatt: Fix possible NULL dereference Andrei Emeltchenko
@ 2014-12-19 13:10 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-12-19 13:10 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-19 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19 12:30 [PATCH] android/gatt: Fix possible NULL dereference Andrei Emeltchenko
2014-12-19 13:10 ` Szymon Janc
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).