From: Szymon Janc <szymon.janc@tieto.com>
To: Anupam Roy <anupam.r@samsung.com>
Cc: linux-bluetooth@vger.kernel.org, sachin.dev@samsung.com
Subject: Re: [PATCH] android/client/if-hl.c:Handle failure from malloc() request
Date: Mon, 27 Jul 2015 21:22:51 +0200 [thread overview]
Message-ID: <1893931.omVqhXpsI8@leonov> (raw)
In-Reply-To: <1437485881-10277-1-git-send-email-anupam.r@samsung.com>
Hi Anupam,
On Tuesday 21 of July 2015 09:38:01 Anupam Roy wrote:
> In case malloc() request fails, just print error message
> and return. Dereferencing reg.mdep_cfg in case of failure
> can lead to crash.
> ---
> android/client/if-hl.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/android/client/if-hl.c b/android/client/if-hl.c
> index e0818ba..bd05671 100644
> --- a/android/client/if-hl.c
> +++ b/android/client/if-hl.c
> @@ -201,6 +201,10 @@ static void register_application_p(int argc, const char
> **argv) reg.number_of_mdeps = atoi(argv[6]);
>
> reg.mdep_cfg = malloc(reg.number_of_mdeps * sizeof(bthl_mdep_cfg_t));
> + if (!reg.mdep_cfg) {
> + haltest_error("malloc failed\n");
> + return;
> + }
> mdep_argc_init = 7;
>
> for (i = 0; i < reg.number_of_mdeps; i++) {
Patch applied, thanks.
--
BR
Szymon Janc
next prev parent reply other threads:[~2015-07-27 19:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 13:38 [PATCH] android/client/if-hl.c:Handle failure from malloc() request Anupam Roy
2015-07-27 19:22 ` Szymon Janc [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-07-21 13:01 Anupam Roy
2015-07-21 13:22 ` Szymon Janc
2015-06-23 12:04 Anupam Roy
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=1893931.omVqhXpsI8@leonov \
--to=szymon.janc@tieto.com \
--cc=anupam.r@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).