From: Lin YuChen <starpt.official@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
starpt.official@gmail.com
Subject: [PATCH v3] staging: rtl8723bs: replace kzalloc/memcpy with kmemdup
Date: Wed, 11 Mar 2026 03:22:56 +0800 [thread overview]
Message-ID: <20260310192256.864370-1-starpt.official@gmail.com> (raw)
Replace the open-coded kzalloc and memcpy combination with kmemdup()
to make the code more concise and idiomatic.
Signed-off-by: Lin YuChen <starpt.official@gmail.com>
---
v3:
- Revert whitespace change to keep the patch atomic as requested by Greg.
v2:
- Use real name in Signed-off-by line as requested by Ethan Tidmore.
- Fix a minor whitespace issue in the error return path.
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 7cb0c6f22bf3..2125606f7775 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1430,14 +1430,12 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
goto exit;
}
- buf = kzalloc(ielen, GFP_KERNEL);
+ buf = kmemdup(pie, ielen, GFP_KERNEL);
if (!buf) {
ret = -ENOMEM;
goto exit;
}
- memcpy(buf, pie, ielen);
-
if (ielen < RSN_HEADER_LEN) {
ret = -1;
goto exit;
--
2.34.1
next reply other threads:[~2026-03-10 19:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 19:22 Lin YuChen [this message]
2026-03-11 3:21 ` [PATCH v3] staging: rtl8723bs: replace kzalloc/memcpy with kmemdup Ethan Tidmore
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=20260310192256.864370-1-starpt.official@gmail.com \
--to=starpt.official@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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