From: Johan Hedberg <johan.hedberg@gmail.com>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: Atul Rai <a.rai@samsung.com>,
linux-bluetooth@vger.kernel.org, sachin.dev@samsung.com
Subject: Re: [PATCH v2] tools/sdptool: Fix NULL pointer dereference
Date: Tue, 28 Jul 2015 11:03:46 +0300 [thread overview]
Message-ID: <20150728080346.GA5327@t440s.lan> (raw)
In-Reply-To: <4524026.9PhAiZIq7z@leonov>
Hi Szymon,
On Tue, Jul 28, 2015, Szymon Janc wrote:
> > > - void **dtdArray;
> > > - void **valueArray;
> > > - void **allocArray;
> > > + void **dtdArray = NULL;
> > > + void **valueArray = NULL;
> > > + void **allocArray = NULL;
> >
> > This doesn't seem to be related to fixing missing malloc failure checks.
> > It's also unnecessary since all of these either way get unconditionally
> > assigned to before reading the values.
>
> Those are due to 'goto cleanup' where all pointers are freed.
Right. I was looking at the existing code and forgot that the patch adds
this label.
> But we could make this code a bit simpler with:
>
> foo = malloc();
> bar = malloc();
> if (!foo || !bar)
> goto cleanup;
>
> Then initialization is not needed.
Agreed.
Johan
prev parent reply other threads:[~2015-07-28 8:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 7:20 [PATCH v2] tools/sdptool: Fix NULL pointer dereference Atul Rai
2015-07-28 7:40 ` Johan Hedberg
2015-07-28 7:57 ` Szymon Janc
2015-07-28 8:03 ` Johan Hedberg [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=20150728080346.GA5327@t440s.lan \
--to=johan.hedberg@gmail.com \
--cc=a.rai@samsung.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=sachin.dev@samsung.com \
--cc=szymon.janc@tieto.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.