* [PATCH] bluetooth: fix error cases
@ 2011-06-01 6:39 Johannes Berg
2011-06-01 18:40 ` John W. Linville
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2011-06-01 6:39 UTC (permalink / raw)
To: John Linville; +Cc: Gustavo F. Padovan, linux-wireless, linux-bluetooth
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bluetooth: fix error cases
2011-06-01 6:39 [PATCH] bluetooth: fix error cases Johannes Berg
@ 2011-06-01 18:40 ` John W. Linville
2011-06-01 18:48 ` Gustavo F. Padovan
0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2011-06-01 18:40 UTC (permalink / raw)
To: Johannes Berg; +Cc: Gustavo F. Padovan, linux-wireless, linux-bluetooth
On Wed, Jun 01, 2011 at 08:39:37AM +0200, Johannes Berg wrote:
> 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>
Dave fixed part of these a couple of weeks ago:
commit 6dcae1eaee2b437536b2fe928a609f9589691ebf
Author: David S. Miller <davem@davemloft.net>
Date: Mon May 16 23:09:26 2011 -0400
bluetooth: Fix warnings in l2cap_core.c
net/bluetooth/l2cap_core.c: In function ‘l2cap_recv_frame’:
net/bluetooth/l2cap_core.c:3758:15: warning: ‘sk’ may be used uninitialized
net/bluetooth/l2cap_core.c:3758:15: note: ‘sk’ was declared here
net/bluetooth/l2cap_core.c:3791:15: warning: ‘sk’ may be used uninitialized
net/bluetooth/l2cap_core.c:3791:15: note: ‘sk’ was declared here
Signed-off-by: David S. Miller <davem@davemloft.net>
The "set but not used" bit still applies...
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bluetooth: fix error cases
2011-06-01 18:40 ` John W. Linville
@ 2011-06-01 18:48 ` Gustavo F. Padovan
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo F. Padovan @ 2011-06-01 18:48 UTC (permalink / raw)
To: John W. Linville; +Cc: Johannes Berg, linux-wireless, linux-bluetooth
* John W. Linville <linville@tuxdriver.com> [2011-06-01 14:40:37 -0400]:
> On Wed, Jun 01, 2011 at 08:39:37AM +0200, Johannes Berg wrote:
> > 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>
>
> Dave fixed part of these a couple of weeks ago:
>
> commit 6dcae1eaee2b437536b2fe928a609f9589691ebf
> Author: David S. Miller <davem@davemloft.net>
> Date: Mon May 16 23:09:26 2011 -0400
>
> bluetooth: Fix warnings in l2cap_core.c
>
> net/bluetooth/l2cap_core.c: In function ‘l2cap_recv_frame’:
> net/bluetooth/l2cap_core.c:3758:15: warning: ‘sk’ may be used uninitialized
> net/bluetooth/l2cap_core.c:3758:15: note: ‘sk’ was declared here
> net/bluetooth/l2cap_core.c:3791:15: warning: ‘sk’ may be used uninitialized
> net/bluetooth/l2cap_core.c:3791:15: note: ‘sk’ was declared here
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
>
> The "set but not used" bit still applies...
Those are fixed in my -next tree now.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-01 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 6:39 [PATCH] bluetooth: fix error cases Johannes Berg
2011-06-01 18:40 ` John W. Linville
2011-06-01 18:48 ` Gustavo F. Padovan
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.