aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-03-26 07:21:41 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-03-28 11:02:40 -0400
commit84d9d0716b2d5f4a27de4801bd2dbf7aff5e1c38 (patch)
tree904a091f877be933498eed2bfbf056f404c3b61a /include
parent8d7e1c7f7e5f9fe8f6279752fc33fcb77afd5001 (diff)
Bluetooth: Don't increment twice in eir_has_data_type()
The parsed variable is already incremented inside the for-loop so there no need to increment it again (not to mention that the code was incrementing it the wrong amount). Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/hci_core.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 8e103281a09b..220d8e0a75fb 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -907,11 +907,10 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
907 907
908static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) 908static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
909{ 909{
910 u8 field_len; 910 size_t parsed = 0;
911 size_t parsed;
912 911
913 for (parsed = 0; parsed < data_len - 1; parsed += field_len) { 912 while (parsed < data_len - 1) {
914 field_len = data[0]; 913 u8 field_len = data[0];
915 914
916 if (field_len == 0) 915 if (field_len == 0)
917 break; 916 break;