From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Atul Rai <a.rai@samsung.com>, linux-bluetooth@vger.kernel.org
Cc: sachin.dev@samsung.com
Subject: Re: [PATCH] android/hal-bluetooth: Fix NULL ptr dereference
Date: Fri, 24 Jul 2015 14:38:11 -0300 [thread overview]
Message-ID: <87si8d4fss.fsf@intel.com> (raw)
In-Reply-To: <1437555933-11333-1-git-send-email-a.rai@samsung.com>
Hi,
Atul Rai <a.rai@samsung.com> writes:
> ping
>
I didn't get the original email.
>> ------- Original Message -------
>> Sender : Atul Kumar Rai<a.rai@samsung.com> Lead Engineer (1)/SRI-Delhi-SWC Group/Samsung Electronics
>> Date : Jun 29, 2015 12:14 (GMT+05:30)
>> Title : [PATCH] android/hal-bluetooth: Fix NULL ptr dereference
>>
>> 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;
>> + }
>> +
Looks OK. Just wondering why it is not using calloc() instead of
'malloc() + sizeof()'.
Cheers,
--
Vinicius
next prev parent reply other threads:[~2015-07-24 17:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 9:05 [PATCH] android/hal-bluetooth: Fix NULL ptr dereference Atul Rai
2015-07-24 17:38 ` Vinicius Costa Gomes [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-06-29 6:44 Atul Rai
2015-07-27 19:21 ` Szymon Janc
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=87si8d4fss.fsf@intel.com \
--to=vinicius.gomes@intel.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).