From: Luka Gejak <lukagejak5@gmail.com>
To: gregkh@linuxfoundation.org
Cc: straube.linux@gmail.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, Luka Gejak <lukagejak5@gmail.com>
Subject: [PATCH 2/3] staging: rtl8723bs: modernize hex output and WMM check
Date: Wed, 28 Jan 2026 18:16:34 +0100 [thread overview]
Message-ID: <20260128171635.39879-2-lukagejak5@gmail.com> (raw)
In-Reply-To: <20260128171635.39879-1-lukagejak5@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2026-01-28 17:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 17:16 [PATCH 1/3] staging: rtl8723bs: rename u1bTmp to val Luka Gejak
2026-01-28 17:16 ` Luka Gejak [this message]
2026-01-29 7:18 ` [PATCH 2/3] staging: rtl8723bs: modernize hex output and WMM check Dan Carpenter
2026-01-31 4:26 ` kernel test robot
2026-01-28 17:16 ` [PATCH 3/3] staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c Luka Gejak
2026-01-29 7:11 ` [PATCH 1/3] staging: rtl8723bs: rename u1bTmp to val Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260128171635.39879-2-lukagejak5@gmail.com \
--to=lukagejak5@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox