mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
Bluetooth: Test 'count' value before enter the loop
Testing first we avoid enter the loop when count = 0. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
0bbdf6cba0
commit
da5f6c37ee
@ -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)
|
||||
return -EILSEQ;
|
||||
|
||||
do {
|
||||
while (count) {
|
||||
rem = hci_reassembly(hdev, type, data, count,
|
||||
type - 1, GFP_ATOMIC);
|
||||
if (rem < 0)
|
||||
@ -1157,7 +1157,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
|
||||
|
||||
data += (count - rem);
|
||||
count = rem;
|
||||
} while (count);
|
||||
};
|
||||
|
||||
return rem;
|
||||
}
|
||||
@ -1170,7 +1170,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count)
|
||||
int type;
|
||||
int rem = 0;
|
||||
|
||||
do {
|
||||
while (count) {
|
||||
struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY];
|
||||
|
||||
if (!skb) {
|
||||
@ -1192,7 +1192,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count)
|
||||
|
||||
data += (count - rem);
|
||||
count = rem;
|
||||
} while (count);
|
||||
};
|
||||
|
||||
return rem;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user