Commit da5f6c37 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan Committed by Marcel Holtmann

Bluetooth: Test 'count' value before enter the loop

Testing first we avoid enter the loop when count = 0.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 0bbdf6cb
...@@ -1149,7 +1149,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count) ...@@ -1149,7 +1149,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
if (type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) if (type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT)
return -EILSEQ; return -EILSEQ;
do { while (count) {
rem = hci_reassembly(hdev, type, data, count, rem = hci_reassembly(hdev, type, data, count,
type - 1, GFP_ATOMIC); type - 1, GFP_ATOMIC);
if (rem < 0) if (rem < 0)
...@@ -1157,7 +1157,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count) ...@@ -1157,7 +1157,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
data += (count - rem); data += (count - rem);
count = rem; count = rem;
} while (count); };
return rem; return rem;
} }
...@@ -1170,7 +1170,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count) ...@@ -1170,7 +1170,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count)
int type; int type;
int rem = 0; int rem = 0;
do { while (count) {
struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY]; struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY];
if (!skb) { if (!skb) {
...@@ -1192,7 +1192,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count) ...@@ -1192,7 +1192,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count)
data += (count - rem); data += (count - rem);
count = rem; count = rem;
} while (count); };
return rem; return rem;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment