[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXqE76ZJO5RCSyJu@smile.fi.intel.com>
Date: Wed, 28 Jan 2026 23:51:43 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Minu Jin <s9430939@...er.com>
Cc: gregkh@...uxfoundation.org, hansg@...nel.org, dan.carpenter@...aro.org,
trohan2000@...il.com, andy@...nel.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
straube.linux@...il.com
Subject: Re: [PATCH v3 1/4] staging: rtl8723bs: replace _rtw_malloc with
kmalloc
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
Powered by blists - more mailing lists