From: Johan Hedberg <johan.hedberg@gmail.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] init and extra checking fixups
Date: Sun, 27 Sep 2009 11:41:51 +0300 [thread overview]
Message-ID: <20090927084151.GB18495@jh-x301> (raw)
In-Reply-To: <200909261237.58379.sgrubb@redhat.com>
Hi Steve,
On Sat, Sep 26, 2009, Steve Grubb wrote:
> In audio/avdtp.c, the avdtp_setconf_cmd function has an exit jump for failed.
> There are several calls to the goto that do not set err to something, meaning
> that the stack contents are what's used. I set err =0 in the beginning so that
> we no longer use the stack contents, but it seems like there should be some
> general error code that says we failed for an unspecified reason.
> diff -urp bluez-4.54.orig/audio/avdtp.c bluez-4.54/audio/avdtp.c
> --- bluez-4.54.orig/audio/avdtp.c 2009-09-26 08:43:56.000000000 -0400
> +++ bluez-4.54/audio/avdtp.c 2009-09-26 11:17:07.000000000 -0400
> @@ -1248,7 +1248,7 @@ static gboolean avdtp_setconf_cmd(struct
> struct conf_rej rej;
> struct avdtp_local_sep *sep;
> struct avdtp_stream *stream;
> - uint8_t err, category = 0x00;
> + uint8_t err = 0, category = 0x00;
> struct audio_device *dev;
> bdaddr_t src, dst;
> GSList *l;
The right error for the two places is AVDTP_BAD_STATE. Setting that error
before jumping to failed also means that we avoid the initialization upon
declaration for the err variable.
David and Luiz commented already on a few other issues which would be good
to fix too. Furthermore, don't be afraid to split your patches into
smaller logical chunks. That way some of them could have been already
applied and pushed upstream. And please leave out the Signed-off-by line
since we don't use it in bluez.
Johan
next prev parent reply other threads:[~2009-09-27 8:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-26 16:37 [PATCH] init and extra checking fixups Steve Grubb
2009-09-27 0:00 ` David Sainty
2009-09-27 3:01 ` Luiz Augusto von Dentz
2009-09-27 8:41 ` Johan Hedberg [this message]
2009-10-02 9:30 ` Johan Hedberg
2009-10-02 15:26 ` Steve Grubb
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=20090927084151.GB18495@jh-x301 \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=sgrubb@redhat.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