From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: "Gustavo F. Padovan" <padovan@profusion.mobi>,
linux-wireless <linux-wireless@vger.kernel.org>,
linux-bluetooth@vger.kernel.org
Subject: [PATCH] bluetooth: fix error cases
Date: Wed, 01 Jun 2011 08:39:37 +0200 [thread overview]
Message-ID: <1306910377.3867.5.camel@jlt3.sipsolutions.net> (raw)
From: Johannes Berg <johannes.berg@intel.com>
The error cases in a few functions can use a
socket variable that was never initialised,
gcc correctly warns about this:
net/bluetooth/l2cap_core.c: In function ‘l2cap_recv_frame’:
include/linux/spinlock.h:325:19: warning: ‘sk’ may be used uninitialized in this function [-Wuninitialized]
net/bluetooth/l2cap_core.c:3789:15: note: ‘sk’ was declared here
include/linux/spinlock.h:325:19: warning: ‘sk’ may be used uninitialized in this function [-Wuninitialized]
net/bluetooth/l2cap_core.c:3756:15: note: ‘sk’ was declared here
Initialise the socket to NULL as clearly intended
by the error handling code.
Also fix a "set but not used" warning.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/bluetooth/l2cap_core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- a/net/bluetooth/l2cap_core.c 2011-06-01 08:33:36.000000000 +0200
+++ b/net/bluetooth/l2cap_core.c 2011-06-01 08:34:35.000000000 +0200
@@ -3667,7 +3667,6 @@ static inline int l2cap_data_channel(str
{
struct l2cap_chan *chan;
struct sock *sk = NULL;
- struct l2cap_pinfo *pi;
u16 control;
u8 tx_seq;
int len;
@@ -3679,7 +3678,6 @@ static inline int l2cap_data_channel(str
}
sk = chan->sk;
- pi = l2cap_pi(sk);
BT_DBG("chan %p, len %d", chan, skb->len);
@@ -3755,7 +3753,7 @@ done:
static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, struct sk_buff *skb)
{
- struct sock *sk;
+ struct sock *sk = NULL;
struct l2cap_chan *chan;
chan = l2cap_global_chan_by_psm(0, psm, conn->src);
@@ -3788,7 +3786,7 @@ done:
static inline int l2cap_att_channel(struct l2cap_conn *conn, __le16 cid, struct sk_buff *skb)
{
- struct sock *sk;
+ struct sock *sk = NULL;
struct l2cap_chan *chan;
chan = l2cap_global_chan_by_scid(0, cid, conn->src);
next reply other threads:[~2011-06-01 6:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 6:39 Johannes Berg [this message]
2011-06-01 18:40 ` [PATCH] bluetooth: fix error cases John W. Linville
2011-06-01 18:48 ` Gustavo F. Padovan
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=1306910377.3867.5.camel@jlt3.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=padovan@profusion.mobi \
/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).