All of lore.kernel.org
 help / color / mirror / Atom feed
* [bluetooth:master 222/247] net/bluetooth/a2mp.c:205 a2mp_getinfo_req() error: we previously assumed
@ 2012-09-28  1:23 Fengguang Wu
  2012-09-28 11:28 ` [PATCH] Bluetooth: A2MP: Fix potential NULL dereference Andrei Emeltchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Fengguang Wu @ 2012-09-28  1:23 UTC (permalink / raw)
  To: kernel-janitors

Hi Andrei,

FYI, there are new smatch warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
head:   29d8a5909bba10accb82eb805c884a2943d7710f
commit: 8e2a0d92c56ec6955526a8b60838c9b00f70540d [222/247] Bluetooth: AMP: Use HCI cmd to Read AMP Info

  net/bluetooth/a2mp.c:61 a2mp_send() Error invalid range 4096 to -1
+ net/bluetooth/a2mp.c:205 a2mp_getinfo_req() error: we previously assumed 'hdev' could be null (see line 195)

vim +205 net/bluetooth/a2mp.c

47f2d97d (Andrei Emeltchenko 2012-05-29  189) 	if (le16_to_cpu(hdr->len) < sizeof(*req))
47f2d97d (Andrei Emeltchenko 2012-05-29  190) 		return -EINVAL;
47f2d97d (Andrei Emeltchenko 2012-05-29  191) 
47f2d97d (Andrei Emeltchenko 2012-05-29  192) 	BT_DBG("id %d", req->id);
47f2d97d (Andrei Emeltchenko 2012-05-29  193) 
47f2d97d (Andrei Emeltchenko 2012-05-29  194) 	hdev = hci_dev_get(req->id);
8e2a0d92 (Andrei Emeltchenko 2012-09-27 @195) 	if (!hdev) {
8e2a0d92 (Andrei Emeltchenko 2012-09-27  196) 		struct a2mp_info_rsp rsp;
8e2a0d92 (Andrei Emeltchenko 2012-09-27  197) 
8e2a0d92 (Andrei Emeltchenko 2012-09-27  198) 		rsp.id = req->id;
8e2a0d92 (Andrei Emeltchenko 2012-09-27  199) 		rsp.status = A2MP_STATUS_INVALID_CTRL_ID;
8e2a0d92 (Andrei Emeltchenko 2012-09-27  200) 
8e2a0d92 (Andrei Emeltchenko 2012-09-27  201) 		a2mp_send(mgr, A2MP_GETINFO_RSP, hdr->ident, sizeof(rsp),
8e2a0d92 (Andrei Emeltchenko 2012-09-27  202) 			  &rsp);
47f2d97d (Andrei Emeltchenko 2012-05-29  203) 	}
47f2d97d (Andrei Emeltchenko 2012-05-29  204) 
8e2a0d92 (Andrei Emeltchenko 2012-09-27 @205) 	if (hdev->dev_type != HCI_BREDR) {
8e2a0d92 (Andrei Emeltchenko 2012-09-27  206) 		mgr->state = READ_LOC_AMP_INFO;
8e2a0d92 (Andrei Emeltchenko 2012-09-27  207) 		hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL);
8e2a0d92 (Andrei Emeltchenko 2012-09-27  208) 	}
47f2d97d (Andrei Emeltchenko 2012-05-29  209) 
8e2a0d92 (Andrei Emeltchenko 2012-09-27  210) 	hci_dev_put(hdev);
47f2d97d (Andrei Emeltchenko 2012-05-29  211) 
47f2d97d (Andrei Emeltchenko 2012-05-29  212) 	skb_pull(skb, sizeof(*req));
47f2d97d (Andrei Emeltchenko 2012-05-29  213) 	return 0;

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

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

end of thread, other threads:[~2012-10-01 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28  1:23 [bluetooth:master 222/247] net/bluetooth/a2mp.c:205 a2mp_getinfo_req() error: we previously assumed Fengguang Wu
2012-09-28 11:28 ` [PATCH] Bluetooth: A2MP: Fix potential NULL dereference Andrei Emeltchenko
2012-10-01 15:02   ` Gustavo 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.