patch-2.4.22 linux-2.4.22/net/bluetooth/hci_core.c
Next file: linux-2.4.22/net/bluetooth/hci_event.c
Previous file: linux-2.4.22/net/bluetooth/cmtp/sock.c
Back to the patch index
Back to the overall index
- Lines: 31
- Date:
2003-08-25 04:44:44.000000000 -0700
- Orig file:
linux-2.4.21/net/bluetooth/hci_core.c
- Orig date:
2003-06-13 07:51:39.000000000 -0700
diff -urN linux-2.4.21/net/bluetooth/hci_core.c linux-2.4.22/net/bluetooth/hci_core.c
@@ -395,7 +395,7 @@
{
struct hci_inquiry_req ir;
struct hci_dev *hdev;
- int err = 0, do_inquiry = 0;
+ int err = 0, do_inquiry = 0, max_rsp;
long timeo;
__u8 *buf, *ptr;
@@ -418,16 +418,19 @@
if (do_inquiry && (err = hci_request(hdev, hci_inq_req, (unsigned long)&ir, timeo)) < 0)
goto done;
+ /* for unlimited number of responses we will use buffer with 255 entries */
+ max_rsp = (ir.num_rsp == 0) ? 255 : ir.num_rsp;
+
/* cache_dump can't sleep. Therefore we allocate temp buffer and then
* copy it to the user space.
*/
- if (!(buf = kmalloc(sizeof(inquiry_info) * ir.num_rsp, GFP_KERNEL))) {
+ if (!(buf = kmalloc(sizeof(inquiry_info) * max_rsp, GFP_KERNEL))) {
err = -ENOMEM;
goto done;
}
hci_dev_lock_bh(hdev);
- ir.num_rsp = inquiry_cache_dump(hdev, ir.num_rsp, buf);
+ ir.num_rsp = inquiry_cache_dump(hdev, max_rsp, buf);
hci_dev_unlock_bh(hdev);
BT_DBG("num_rsp %d", ir.num_rsp);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)