From: Szymon Janc <szymon.janc@tieto.com>
To: Atul Rai <a.rai@samsung.com>
Cc: linux-bluetooth@vger.kernel.org, sachin.dev@samsung.com
Subject: Re: [PATCH] android/hal-bluetooth: Fix NULL ptr dereference
Date: Mon, 27 Jul 2015 21:21:59 +0200 [thread overview]
Message-ID: <1916606.IEpI44LjIf@leonov> (raw)
In-Reply-To: <1435560253-5511-1-git-send-email-a.rai@samsung.com>
Hi Atul,
On Monday 29 of June 2015 12:14:13 Atul Rai wrote:
> Add NULL check on malloc return to fix NULL pointer dereference
> in case malloc fails.
> ---
> android/hal-bluetooth.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
> index e24f7d2..66f4a37 100644
> --- a/android/hal-bluetooth.c
> +++ b/android/hal-bluetooth.c
> @@ -19,6 +19,7 @@
> #include <stdlib.h>
> #include <stdbool.h>
> #include <string.h>
> +#include <errno.h>
>
> #include <cutils/properties.h>
>
> @@ -1103,6 +1104,11 @@ static int open_bluetooth(const struct hw_module_t
> *module, char const *name,
>
> DBG("");
>
> + if (!dev) {
> + error("Failed to allocate memory for device");
> + return -ENOMEM;
> + }
> +
> memset(dev, 0, sizeof(bluetooth_device_t));
> dev->common.tag = HARDWARE_DEVICE_TAG;
> dev->common.version = 0;
Patch applied, thanks.
--
BR
Szymon Janc
next prev parent reply other threads:[~2015-07-27 19:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 6:44 [PATCH] android/hal-bluetooth: Fix NULL ptr dereference Atul Rai
2015-07-27 19:21 ` Szymon Janc [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-07-22 9:05 Atul Rai
2015-07-24 17:38 ` Vinicius Costa Gomes
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=1916606.IEpI44LjIf@leonov \
--to=szymon.janc@tieto.com \
--cc=a.rai@samsung.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=sachin.dev@samsung.com \
/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).