diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2010-07-24 00:34:54 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-27 15:33:49 -0400 |
commit | da5f6c37eee040775997191d1a1bc91c0c1e51eb (patch) | |
tree | 91c50ab042076832cba9542e594b7f3a730c7892 /net/bluetooth | |
parent | 0bbdf6cba0fb730ae2f2cfd5ead3d1e2e5498ddc (diff) |
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/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 8 |
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) | |||
1149 | if (type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) | 1149 | if (type < HCI_ACLDATA_PKT || type > HCI_EVENT_PKT) |
1150 | return -EILSEQ; | 1150 | return -EILSEQ; |
1151 | 1151 | ||
1152 | do { | 1152 | while (count) { |
1153 | rem = hci_reassembly(hdev, type, data, count, | 1153 | rem = hci_reassembly(hdev, type, data, count, |
1154 | type - 1, GFP_ATOMIC); | 1154 | type - 1, GFP_ATOMIC); |
1155 | if (rem < 0) | 1155 | if (rem < 0) |
@@ -1157,7 +1157,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count) | |||
1157 | 1157 | ||
1158 | data += (count - rem); | 1158 | data += (count - rem); |
1159 | count = rem; | 1159 | count = rem; |
1160 | } while (count); | 1160 | }; |
1161 | 1161 | ||
1162 | return rem; | 1162 | return rem; |
1163 | } | 1163 | } |
@@ -1170,7 +1170,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count) | |||
1170 | int type; | 1170 | int type; |
1171 | int rem = 0; | 1171 | int rem = 0; |
1172 | 1172 | ||
1173 | do { | 1173 | while (count) { |
1174 | struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY]; | 1174 | struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY]; |
1175 | 1175 | ||
1176 | if (!skb) { | 1176 | if (!skb) { |
@@ -1192,7 +1192,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count) | |||
1192 | 1192 | ||
1193 | data += (count - rem); | 1193 | data += (count - rem); |
1194 | count = rem; | 1194 | count = rem; |
1195 | } while (count); | 1195 | }; |
1196 | 1196 | ||
1197 | return rem; | 1197 | return rem; |
1198 | } | 1198 | } |