summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-07-24 01:34:54 -0300
committerMarcel Holtmann <marcel@holtmann.org>2010-07-27 12:33:49 -0700
commitda5f6c37eee040775997191d1a1bc91c0c1e51eb (patch)
tree91c50ab042076832cba9542e594b7f3a730c7892 /net
parent0bbdf6cba0fb730ae2f2cfd5ead3d1e2e5498ddc (diff)
downloadtalos-obmc-linux-da5f6c37eee040775997191d1a1bc91c0c1e51eb.tar.gz
talos-obmc-linux-da5f6c37eee040775997191d1a1bc91c0c1e51eb.zip
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>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 995c9f9b84d0..8303f1c9ef54 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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;
}
OpenPOWER on IntegriCloud