]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Bluetooth: Test 'count' value before enter the loop
authorGustavo F. Padovan <padovan@profusion.mobi>
Sat, 24 Jul 2010 04:34:54 +0000 (01:34 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 27 Jul 2010 19:33:49 +0000 (12:33 -0700)
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>
net/bluetooth/hci_core.c

index 995c9f9b84d05635dd1b1be59794dd84cdce0a9e..8303f1c9ef548a13ab7ecfa8f2403b0a048f413e 100644 (file)
@@ -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;
 }