From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Minu Jin <s9430939@naver.com>
Cc: gregkh@linuxfoundation.org, hansg@kernel.org,
dan.carpenter@linaro.org, trohan2000@gmail.com, andy@kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
straube.linux@gmail.com
Subject: Re: [PATCH v3 1/4] staging: rtl8723bs: replace _rtw_malloc with kmalloc
Date: Wed, 28 Jan 2026 23:51:43 +0200 [thread overview]
Message-ID: <aXqE76ZJO5RCSyJu@smile.fi.intel.com> (raw)
In-Reply-To: <20260128140954.1065382-2-s9430939@naver.com>
On Wed, Jan 28, 2026 at 11:09:51PM +0900, Minu Jin wrote:
> Remove wrapper function _rtw_malloc and macro rtw_malloc.
> Replace all rtw_malloc with kmalloc.
>
> All call sites are reviewed to select GFP_KERNEL or GFP_ATOMIC.
>
> 1. GFP_KERNEL:
> Used in paths that are executed in process context and are allowed to sleep.
>
> - Driver initialization and probe paths.
> - Workqueue callbacks and cfg80211 configuration callbacks.
>
> 2. GFP_ATOMIC:
> Used in paths that must not sleep because they operate in atomic contexts.
>
> - Interrupt handlers and SoftIRQ contexts.
> - Functions called while holding spinlocks.
> - Low-level I/O operations (SDIO) (eg, sdio_read32())
...
> static void update_BCNTIM(struct adapter *padapter)
> if (remainder_ielen > 0) {
> - pbackup_remainder_ie = rtw_malloc(remainder_ielen);
> + pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
> if (pbackup_remainder_ie && premainder_ie)
> memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
I haven't read the code in full, but why not
if (premainder_ie)
pbackup_remainder_ie = kmemdup(rpremainder_ie, emainder_ielen, GFP_ATOMIC);
else
pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
> }
...
> static void update_bcn_wps_ie(struct adapter *padapter)
> if (remainder_ielen > 0) {
> - pbackup_remainder_ie = rtw_malloc(remainder_ielen);
> + pbackup_remainder_ie = kmalloc(remainder_ielen, GFP_ATOMIC);
> if (pbackup_remainder_ie)
> memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
This is simply kmemdup().
> }
...
Also check other places if they are copying existing data.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-01-28 21:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 14:09 [PATCH v3 0/4] staging: rtl8723bs: remove memory allocation wrappers Minu Jin
2026-01-28 14:09 ` [PATCH v3 1/4] staging: rtl8723bs: replace _rtw_malloc with kmalloc Minu Jin
2026-01-28 21:51 ` Andy Shevchenko [this message]
2026-01-28 21:52 ` Andy Shevchenko
2026-01-28 14:09 ` [PATCH v3 2/4] staging: rtl8723bs: replace rtw_zmalloc with kzalloc Minu Jin
2026-01-28 22:02 ` Andy Shevchenko
2026-01-28 14:09 ` [PATCH v3 3/4] staging: rtl8723bs: replace skb allocation wrappers and fix build Minu Jin
2026-01-28 22:04 ` Andy Shevchenko
2026-01-28 14:09 ` [PATCH v3 4/4] staging: rtl8723bs: remove unused allocation wrapper functions Minu Jin
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=aXqE76ZJO5RCSyJu@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=s9430939@naver.com \
--cc=straube.linux@gmail.com \
--cc=trohan2000@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