summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorErick Archer <erick.archer@outlook.com>2024-05-18 10:30:39 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-07-14 21:33:30 -0400
commitc61e41121036aa610e904ef60f8520e10455ee8c (patch)
tree0b29e2a9eef7826ff560334032f314352f54f15d /net
parent8f7dfe171c576aaec4911cc59feaed26d79c7c7f (diff)
Bluetooth: hci_core: Prefer array indexing over pointer arithmetic
Refactor the list_for_each_entry() loop of hci_get_dev_list() function to use array indexing instead of pointer arithmetic. This way, the code is more readable and idiomatic. Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Erick Archer <erick.archer@outlook.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index a2cad8a982f6..55bdc365916f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -828,8 +828,8 @@ int hci_get_dev_list(void __user *arg)
if (hci_dev_test_flag(hdev, HCI_AUTO_OFF))
flags &= ~BIT(HCI_UP);
- (dr + n)->dev_id = hdev->id;
- (dr + n)->dev_opt = flags;
+ dr[n].dev_id = hdev->id;
+ dr[n].dev_opt = flags;
if (++n >= dev_num)
break;