Re: [PATCH v5 1/5] staging: rtl8723bs: introduce kmemdup() where applicable

From: Andy Shevchenko

Date: Wed Feb 04 2026 - 05:17:29 EST


On Wed, Feb 04, 2026 at 03:44:50PM +0900, Minu Jin wrote:
> Replace memory allocation followed by memcpy() with kmemdup() to simplify
> the code and improve readability.

Right, thanks for this change!

My comments below.

First of all, you also need to add a note why GFP_ATOMIC.

...

> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)

> spin_lock_bh(&pstat->lock);
> kfree(pstat->passoc_req);
> pstat->assoc_req_len = 0;
> - pstat->passoc_req = rtw_zmalloc(pkt_len);
> + pstat->passoc_req = kmemdup(pframe, pkt_len, GFP_ATOMIC);
> if (pstat->passoc_req) {
> - memcpy(pstat->passoc_req, pframe, pkt_len);
> pstat->assoc_req_len = pkt_len;
> }

Now {} should be also removed.

...

The rest LGTM.

--
With Best Regards,
Andy Shevchenko