[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260128171635.39879-2-lukagejak5@gmail.com>
Date: Wed, 28 Jan 2026 18:16:34 +0100
From: Luka Gejak <lukagejak5@...il.com>
To: gregkh@...uxfoundation.org
Cc: straube.linux@...il.com,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Luka Gejak <lukagejak5@...il.com>
Subject: [PATCH 2/3] staging: rtl8723bs: modernize hex output and WMM check
Use %*ph for hex dumps to simplify code.
Refactor WMM IE check to use memcmp() and validate length first for safety.
Signed-off-by: Luka Gejak <lukagejak5@...il.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 98704179ad35..4b671cde97f0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2000,7 +2000,8 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_
while (i < in_len) {
ielength = initial_out_len;
- if (in_ie[i] == 0xDD && in_ie[i+2] == 0x00 && in_ie[i+3] == 0x50 && in_ie[i+4] == 0xF2 && in_ie[i+5] == 0x02 && i+5 < in_len) { /* WMM element ID and OUI */
+ if (i + 5 < in_len && in_ie[i] == 0xDD &&
+ !memcmp(&in_ie[i + 2], "\x00\x50\xf2\x02", 4)) {
for (j = i; j < i + 9; j++) {
out_ie[ielength] = in_ie[j];
ielength++;
@@ -2084,8 +2085,7 @@ static void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
len = sec_ie[1] + 2;
len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX;
- for (i = 0; i < len; i++)
- p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "%02x", sec_ie[i]);
+ p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), " %*ph", len, sec_ie);
p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), ")");
--
2.52.0
Powered by blists - more mailing lists