linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bluetooth:master 60/61] net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types)
@ 2012-11-09 11:28 kbuild test robot
  2012-11-09 15:16 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2012-11-09 11:28 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: linux-bluetooth, Gustavo Padovan

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
head:   108777e09bbe7874dc5224173a1e3f3ee4ac6471
commit: c82263e2cfbf6d5c030d0e424ecc91402910e46e [60/61] Bluetooth: Add support for setting LE advertising data


sparse warnings:

+ net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types)
net/bluetooth/hci_core.c:683:19:    expected unsigned char [unsigned] [addressable] [usertype] length
net/bluetooth/hci_core.c:683:19:    got restricted __le16 [usertype] <noident>

vim +683 net/bluetooth/hci_core.c

c82263e2 Johan Hedberg 2012-11-08  667  		goto unlock;
c82263e2 Johan Hedberg 2012-11-08  668  	}
c82263e2 Johan Hedberg 2012-11-08  669  
c82263e2 Johan Hedberg 2012-11-08  670  	memset(&cp, 0, sizeof(cp));
c82263e2 Johan Hedberg 2012-11-08  671  
c82263e2 Johan Hedberg 2012-11-08  672  	len = create_ad(hdev, cp.data);
c82263e2 Johan Hedberg 2012-11-08  673  
c82263e2 Johan Hedberg 2012-11-08  674  	if (hdev->adv_data_len == len &&
c82263e2 Johan Hedberg 2012-11-08  675  	    memcmp(cp.data, hdev->adv_data, len) == 0) {
c82263e2 Johan Hedberg 2012-11-08  676  		err = 0;
c82263e2 Johan Hedberg 2012-11-08  677  		goto unlock;
c82263e2 Johan Hedberg 2012-11-08  678  	}
c82263e2 Johan Hedberg 2012-11-08  679  
c82263e2 Johan Hedberg 2012-11-08  680  	memcpy(hdev->adv_data, cp.data, sizeof(cp.data));
c82263e2 Johan Hedberg 2012-11-08  681  	hdev->adv_data_len = len;
c82263e2 Johan Hedberg 2012-11-08  682  
c82263e2 Johan Hedberg 2012-11-08 @683  	cp.length = cpu_to_le16(len);
c82263e2 Johan Hedberg 2012-11-08  684  
c82263e2 Johan Hedberg 2012-11-08  685  	err = hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_DATA, sizeof(cp), &cp);
c82263e2 Johan Hedberg 2012-11-08  686  
c82263e2 Johan Hedberg 2012-11-08  687  unlock:
c82263e2 Johan Hedberg 2012-11-08  688  	hci_dev_unlock(hdev);
c82263e2 Johan Hedberg 2012-11-08  689  
c82263e2 Johan Hedberg 2012-11-08  690  	return err;
c82263e2 Johan Hedberg 2012-11-08  691  }

---
0-DAY kernel build testing backend         Open Source Technology Center
Fengguang Wu, Yuanhan Liu                              Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bluetooth:master 60/61] net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types)
  2012-11-09 11:28 [bluetooth:master 60/61] net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types) kbuild test robot
@ 2012-11-09 15:16 ` Johan Hedberg
  2012-11-10 18:23   ` Gustavo Padovan
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2012-11-09 15:16 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-bluetooth

Hi,

On Fri, Nov 09, 2012, kbuild test robot wrote:
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
> head:   108777e09bbe7874dc5224173a1e3f3ee4ac6471
> commit: c82263e2cfbf6d5c030d0e424ecc91402910e46e [60/61] Bluetooth: Add support for setting LE advertising data
> 
> 
> sparse warnings:
> 
> + net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types)
> net/bluetooth/hci_core.c:683:19:    expected unsigned char [unsigned] [addressable] [usertype] length
> net/bluetooth/hci_core.c:683:19:    got restricted __le16 [usertype] <noident>
> 
> vim +683 net/bluetooth/hci_core.c
> 
> c82263e2 Johan Hedberg 2012-11-08  667  		goto unlock;
> c82263e2 Johan Hedberg 2012-11-08  668  	}
> c82263e2 Johan Hedberg 2012-11-08  669  
> c82263e2 Johan Hedberg 2012-11-08  670  	memset(&cp, 0, sizeof(cp));
> c82263e2 Johan Hedberg 2012-11-08  671  
> c82263e2 Johan Hedberg 2012-11-08  672  	len = create_ad(hdev, cp.data);
> c82263e2 Johan Hedberg 2012-11-08  673  
> c82263e2 Johan Hedberg 2012-11-08  674  	if (hdev->adv_data_len == len &&
> c82263e2 Johan Hedberg 2012-11-08  675  	    memcmp(cp.data, hdev->adv_data, len) == 0) {
> c82263e2 Johan Hedberg 2012-11-08  676  		err = 0;
> c82263e2 Johan Hedberg 2012-11-08  677  		goto unlock;
> c82263e2 Johan Hedberg 2012-11-08  678  	}
> c82263e2 Johan Hedberg 2012-11-08  679  
> c82263e2 Johan Hedberg 2012-11-08  680  	memcpy(hdev->adv_data, cp.data, sizeof(cp.data));
> c82263e2 Johan Hedberg 2012-11-08  681  	hdev->adv_data_len = len;
> c82263e2 Johan Hedberg 2012-11-08  682  
> c82263e2 Johan Hedberg 2012-11-08 @683  	cp.length = cpu_to_le16(len);

This is actually a real bug which would show up at least on big endian
systems: cp.length is just one byte so no byte order conversion should
be attempted. Gustavo, do you want me to send a patch to fix it or will
you remove this patch from the current tree and let me send a revised
version?

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bluetooth:master 60/61] net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types)
  2012-11-09 15:16 ` Johan Hedberg
@ 2012-11-10 18:23   ` Gustavo Padovan
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo Padovan @ 2012-11-10 18:23 UTC (permalink / raw)
  To: Gustavo Padovan, linux-bluetooth

Hi,

* Johan Hedberg <johan.hedberg@intel.com> [2012-11-09 17:16:49 +0200]:

> Hi,
> 
> On Fri, Nov 09, 2012, kbuild test robot wrote:
> > tree:   git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
> > head:   108777e09bbe7874dc5224173a1e3f3ee4ac6471
> > commit: c82263e2cfbf6d5c030d0e424ecc91402910e46e [60/61] Bluetooth: Add support for setting LE advertising data
> > 
> > 
> > sparse warnings:
> > 
> > + net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types)
> > net/bluetooth/hci_core.c:683:19:    expected unsigned char [unsigned] [addressable] [usertype] length
> > net/bluetooth/hci_core.c:683:19:    got restricted __le16 [usertype] <noident>
> > 
> > vim +683 net/bluetooth/hci_core.c
> > 
> > c82263e2 Johan Hedberg 2012-11-08  667  		goto unlock;
> > c82263e2 Johan Hedberg 2012-11-08  668  	}
> > c82263e2 Johan Hedberg 2012-11-08  669  
> > c82263e2 Johan Hedberg 2012-11-08  670  	memset(&cp, 0, sizeof(cp));
> > c82263e2 Johan Hedberg 2012-11-08  671  
> > c82263e2 Johan Hedberg 2012-11-08  672  	len = create_ad(hdev, cp.data);
> > c82263e2 Johan Hedberg 2012-11-08  673  
> > c82263e2 Johan Hedberg 2012-11-08  674  	if (hdev->adv_data_len == len &&
> > c82263e2 Johan Hedberg 2012-11-08  675  	    memcmp(cp.data, hdev->adv_data, len) == 0) {
> > c82263e2 Johan Hedberg 2012-11-08  676  		err = 0;
> > c82263e2 Johan Hedberg 2012-11-08  677  		goto unlock;
> > c82263e2 Johan Hedberg 2012-11-08  678  	}
> > c82263e2 Johan Hedberg 2012-11-08  679  
> > c82263e2 Johan Hedberg 2012-11-08  680  	memcpy(hdev->adv_data, cp.data, sizeof(cp.data));
> > c82263e2 Johan Hedberg 2012-11-08  681  	hdev->adv_data_len = len;
> > c82263e2 Johan Hedberg 2012-11-08  682  
> > c82263e2 Johan Hedberg 2012-11-08 @683  	cp.length = cpu_to_le16(len);
> 
> This is actually a real bug which would show up at least on big endian
> systems: cp.length is just one byte so no byte order conversion should
> be attempted. Gustavo, do you want me to send a patch to fix it or will
> you remove this patch from the current tree and let me send a revised
> version?

I fixed this patch and pushed a new version to bluetooth-next. Should be all
good now.

	Gustavo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-10 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-09 11:28 [bluetooth:master 60/61] net/bluetooth/hci_core.c:683:19: sparse: incorrect type in assignment (different base types) kbuild test robot
2012-11-09 15:16 ` Johan Hedberg
2012-11-10 18:23   ` Gustavo Padovan

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).