aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2011-09-09 17:56:26 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-09-21 11:59:16 -0400
commitf8523598ee608a8c4d1f3bbd3639785be3321111 (patch)
tree720d06d2bb311211994d809c6ad7577f630d5f0c /net/bluetooth/mgmt.c
parenta8f13c8cd2c732828e5da735c204447a55cdab03 (diff)
Bluetooth: Check 'dev_class' in mgmt_device_found()
The mgmt_device_found event will be used to report LE devices found during discovery procedure. Since LE advertising reports events doesn't have class of device information, we need to check if 'dev_class' is not NULL before copying it. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 45b7a4e5aa42..5a94eec06caa 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2324,12 +2324,14 @@ int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi,
2324 memset(&ev, 0, sizeof(ev)); 2324 memset(&ev, 0, sizeof(ev));
2325 2325
2326 bacpy(&ev.bdaddr, bdaddr); 2326 bacpy(&ev.bdaddr, bdaddr);
2327 memcpy(ev.dev_class, dev_class, sizeof(ev.dev_class));
2328 ev.rssi = rssi; 2327 ev.rssi = rssi;
2329 2328
2330 if (eir) 2329 if (eir)
2331 memcpy(ev.eir, eir, sizeof(ev.eir)); 2330 memcpy(ev.eir, eir, sizeof(ev.eir));
2332 2331
2332 if (dev_class)
2333 memcpy(ev.dev_class, dev_class, sizeof(ev.dev_class));
2334
2333 return mgmt_event(MGMT_EV_DEVICE_FOUND, index, &ev, sizeof(ev), NULL); 2335 return mgmt_event(MGMT_EV_DEVICE_FOUND, index, &ev, sizeof(ev), NULL);
2334} 2336}
2335 2337