diff mbox

6lowpan: set peer_addr correctly again

Message ID 20170328132935.382216-1-arnd@arndb.de
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Arnd Bergmann March 28, 2017, 1:29 p.m. UTC
A bugfix accidentally changed one line to return the peer_addr
from setup_header, causing it to become unused:

net/bluetooth/6lowpan.c: In function 'setup_header':
net/bluetooth/6lowpan.c:402:14: error: parameter 'peer_addr' set but not used [-Werror=unused-but-set-parameter]

The only user of the variable is a subsequent printk(), and
it is not otherwise initialized, so reverting the changed line
looks like the right fix.

Fixes: fb6f2f606ce8 ("6lowpan: Fix IID format for Bluetooth")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/bluetooth/6lowpan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcel Holtmann March 28, 2017, 1:37 p.m. UTC | #1
Hi Arnd,

> A bugfix accidentally changed one line to return the peer_addr
> from setup_header, causing it to become unused:
> 
> net/bluetooth/6lowpan.c: In function 'setup_header':
> net/bluetooth/6lowpan.c:402:14: error: parameter 'peer_addr' set but not used [-Werror=unused-but-set-parameter]
> 
> The only user of the variable is a subsequent printk(), and
> it is not otherwise initialized, so reverting the changed line
> looks like the right fix.
> 
> Fixes: fb6f2f606ce8 ("6lowpan: Fix IID format for Bluetooth")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/bluetooth/6lowpan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I took Colin’s patch since it showed up first in my inbox.

Regards

Marcel
Von Dentz, Luiz March 28, 2017, 1:42 p.m. UTC | #2
Hi Marcel,

On Tue, Mar 28, 2017 at 4:37 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Arnd,
>
>> A bugfix accidentally changed one line to return the peer_addr
>> from setup_header, causing it to become unused:
>>
>> net/bluetooth/6lowpan.c: In function 'setup_header':
>> net/bluetooth/6lowpan.c:402:14: error: parameter 'peer_addr' set but not used [-Werror=unused-but-set-parameter]
>>
>> The only user of the variable is a subsequent printk(), and
>> it is not otherwise initialized, so reverting the changed line
>> looks like the right fix.
>>
>> Fixes: fb6f2f606ce8 ("6lowpan: Fix IID format for Bluetooth")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> net/bluetooth/6lowpan.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> I took Colin’s patch since it showed up first in my inbox.

Thanks, I might be missing something since the error doesn't show up for me:

  CC [M]  net/bluetooth/6lowpan.o
  LD [M]  net/bluetooth/bluetooth_6lowpan.o
diff mbox

Patch

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 24348c8579dd..ba28c7b1557f 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -432,7 +432,7 @@  static int setup_header(struct sk_buff *skb, struct net_device *netdev,
 		}
 
 		daddr = peer->lladdr;
-		peer_addr = &peer->chan->dst;
+		*peer_addr = peer->chan->dst;
 		*peer_addr_type = peer->chan->dst_type;
 		lowpan_cb(skb)->chan = peer->chan;