public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup
@ 2026-03-04 13:07 Alexandru Hossu
  2026-03-04 13:24 ` Greg KH
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Alexandru Hossu @ 2026-03-04 13:07 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Alexandru Hossu

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
---
 .../devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml          | 2 --
 drivers/staging/rtl8723bs/hal/sdio_ops.c                      | 4 +---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c             | 4 +---
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml b/Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml
index 6d1cd651e..a21cae6e6 100644
--- a/Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml
+++ b/Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml
@@ -31,7 +31,6 @@ properties:
     items:
       - const: interrupt
 
-  interrupt-parent: true
 
   xlnx,use-rx-data:
     $ref: /schemas/types.yaml#/definitions/uint32
@@ -56,7 +55,6 @@ required:
   - reg
   - interrupts
   - interrupt-names
-  - interrupt-parent
   - xlnx,use-rx-data
   - xlnx,use-tx-data
 
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index c9cb20c61..514c857a9 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -583,12 +583,10 @@ s32 sdio_local_write(
 	)
 		return sd_cmd52_write(intfhdl, addr, cnt, buf);
 
-	tmpbuf = kmalloc(cnt, GFP_ATOMIC);
+	tmpbuf = kmemdup(buf, cnt, GFP_ATOMIC);
 	if (!tmpbuf)
 		return -ENOMEM;
 
-	memcpy(tmpbuf, buf, cnt);
-
 	err = sd_write(intfhdl, addr, cnt, tmpbuf);
 
 	kfree(tmpbuf);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 7cb0c6f22..2125606f7 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.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup
  2026-03-04 13:07 [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup Alexandru Hossu
@ 2026-03-04 13:24 ` Greg KH
  2026-03-04 13:51 ` [PATCH v3] " Alexandru Hossu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2026-03-04 13:24 UTC (permalink / raw)
  To: Alexandru Hossu; +Cc: linux-staging, linux-kernel

On Wed, Mar 04, 2026 at 02:07:06PM +0100, Alexandru Hossu wrote:
> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
> ---
>  .../devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml          | 2 --

This is not a drivers/staging/ change :(


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup
  2026-03-04 13:07 [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup Alexandru Hossu
  2026-03-04 13:24 ` Greg KH
@ 2026-03-04 13:51 ` Alexandru Hossu
  2026-03-04 13:59 ` [PATCH v4] staging: rtl8723bs: replace alloc+memcpy " Alexandru Hossu
  2026-03-05  1:09 ` [PATCH v5] staging: rtl8723bs: replace alloc+memcpy with kmemdup Alexandru Hossu
  3 siblings, 0 replies; 9+ messages in thread
From: Alexandru Hossu @ 2026-03-04 13:51 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Alexandru Hossu

Replace open-coded alloc+memcpy patterns with kmemdup().
This simplifies the code and avoids manual size/copy handling.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>

v3:
  - Drop unrelated DT binding changes from v2.
  - Wrap long line reported by checkpatch.

---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1295b1c1e..0f50f7141 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -128,7 +128,8 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
 		goto exit;
 
 	spt_band->channels = (struct ieee80211_channel *)(((u8 *)spt_band) + sizeof(struct ieee80211_supported_band));
-	spt_band->bitrates = (struct ieee80211_rate *)(((u8 *)spt_band->channels) + array_size(n_channels, sizeof(struct ieee80211_channel)));
+	spt_band->bitrates = (struct ieee80211_rate *)(((u8 *)spt_band->channels) +
+		array_size(n_channels, sizeof(struct ieee80211_channel)));
 	spt_band->band = band;
 	spt_band->n_channels = n_channels;
 	spt_band->n_bitrates = n_bitrates;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v4] staging: rtl8723bs: replace alloc+memcpy with kmemdup
  2026-03-04 13:07 [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup Alexandru Hossu
  2026-03-04 13:24 ` Greg KH
  2026-03-04 13:51 ` [PATCH v3] " Alexandru Hossu
@ 2026-03-04 13:59 ` Alexandru Hossu
  2026-03-04 14:48   ` Greg KH
  2026-03-05 10:23   ` [PATCH v6] staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie Alexandru Hossu
  2026-03-05  1:09 ` [PATCH v5] staging: rtl8723bs: replace alloc+memcpy with kmemdup Alexandru Hossu
  3 siblings, 2 replies; 9+ messages in thread
From: Alexandru Hossu @ 2026-03-04 13:59 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Alexandru Hossu

Replace open-coded alloc+memcpy patterns with kmemdup().

This simplifies the code and avoids manual size/copy handling.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>

v4:
  - Drop unrelated DT binding changes from earlier attempts.
  - Include both rtl8723bs changes in one staging-only patch.
  - Wrap long line reported by checkpatch.

---
 drivers/staging/rtl8723bs/hal/sdio_ops.c          | 3 +--
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index c9cb20c61..6e03d3d8a 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -583,11 +583,10 @@ s32 sdio_local_write(
 	)
 		return sd_cmd52_write(intfhdl, addr, cnt, buf);
 
-	tmpbuf = kmalloc(cnt, GFP_ATOMIC);
+	tmpbuf = kmemdup(buf, cnt, GFP_ATOMIC);
 	if (!tmpbuf)
 		return -ENOMEM;
 
-	memcpy(tmpbuf, buf, cnt);
 
 	err = sd_write(intfhdl, addr, cnt, tmpbuf);
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 7cb0c6f22..0ae7b6389 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1430,13 +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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v4] staging: rtl8723bs: replace alloc+memcpy with kmemdup
  2026-03-04 13:59 ` [PATCH v4] staging: rtl8723bs: replace alloc+memcpy " Alexandru Hossu
@ 2026-03-04 14:48   ` Greg KH
  2026-03-05 10:23   ` [PATCH v6] staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie Alexandru Hossu
  1 sibling, 0 replies; 9+ messages in thread
From: Greg KH @ 2026-03-04 14:48 UTC (permalink / raw)
  To: Alexandru Hossu; +Cc: linux-staging, linux-kernel

On Wed, Mar 04, 2026 at 02:59:14PM +0100, Alexandru Hossu wrote:
> Replace open-coded alloc+memcpy patterns with kmemdup().
> 
> This simplifies the code and avoids manual size/copy handling.
> 
> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
> 
> v4:
>   - Drop unrelated DT binding changes from earlier attempts.
>   - Include both rtl8723bs changes in one staging-only patch.
>   - Wrap long line reported by checkpatch.
> 
> ---
>  drivers/staging/rtl8723bs/hal/sdio_ops.c          | 3 +--
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)

Please slow down and read the documentation that my bot pointed you at.
The version information here is not done properly :(

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v5] staging: rtl8723bs: replace alloc+memcpy with kmemdup
  2026-03-04 13:07 [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup Alexandru Hossu
                   ` (2 preceding siblings ...)
  2026-03-04 13:59 ` [PATCH v4] staging: rtl8723bs: replace alloc+memcpy " Alexandru Hossu
@ 2026-03-05  1:09 ` Alexandru Hossu
  2026-03-05  5:51   ` Dan Carpenter
  3 siblings, 1 reply; 9+ messages in thread
From: Alexandru Hossu @ 2026-03-05  1:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Alexandru Hossu

Replace open-coded alloc+memcpy patterns with kmemdup().

This simplifies the code and avoids manual size/copy handling.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
---
v5:
  - Move version history below the --- line (per submitting-patches).

v4:
  - Drop unrelated DT binding changes from earlier attempts.
  - Include both rtl8723bs changes in one staging-only patch.
  - Wrap long line reported by checkpatch.

 drivers/staging/rtl8723bs/hal/sdio_ops.c          | 3 +--
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index c9cb20c61..6e03d3d8a 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -583,11 +583,10 @@ s32 sdio_local_write(
 	)
 		return sd_cmd52_write(intfhdl, addr, cnt, buf);
 
-	tmpbuf = kmalloc(cnt, GFP_ATOMIC);
+	tmpbuf = kmemdup(buf, cnt, GFP_ATOMIC);
 	if (!tmpbuf)
 		return -ENOMEM;
 
-	memcpy(tmpbuf, buf, cnt);
 
 	err = sd_write(intfhdl, addr, cnt, tmpbuf);
 
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 7cb0c6f22..0ae7b6389 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1430,13 +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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v5] staging: rtl8723bs: replace alloc+memcpy with kmemdup
  2026-03-05  1:09 ` [PATCH v5] staging: rtl8723bs: replace alloc+memcpy with kmemdup Alexandru Hossu
@ 2026-03-05  5:51   ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2026-03-05  5:51 UTC (permalink / raw)
  To: Alexandru Hossu; +Cc: gregkh, linux-staging, linux-kernel

On Thu, Mar 05, 2026 at 02:09:17AM +0100, Alexandru Hossu wrote:
> Replace open-coded alloc+memcpy patterns with kmemdup().
> 
> This simplifies the code and avoids manual size/copy handling.
> 
> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
> ---
> v5:
>   - Move version history below the --- line (per submitting-patches).
> 
> v4:
>   - Drop unrelated DT binding changes from earlier attempts.
>   - Include both rtl8723bs changes in one staging-only patch.
>   - Wrap long line reported by checkpatch.
> 
>  drivers/staging/rtl8723bs/hal/sdio_ops.c          | 3 +--
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> index c9cb20c61..6e03d3d8a 100644
> --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
> +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
> @@ -583,11 +583,10 @@ s32 sdio_local_write(
>  	)
>  		return sd_cmd52_write(intfhdl, addr, cnt, buf);
>  
> -	tmpbuf = kmalloc(cnt, GFP_ATOMIC);
> +	tmpbuf = kmemdup(buf, cnt, GFP_ATOMIC);
>  	if (!tmpbuf)
>  		return -ENOMEM;
>  
> -	memcpy(tmpbuf, buf, cnt);
>  

Delete the extra blank line.  Also this doesn't apply to linux-next
but I haven't investigated further.

>  	err = sd_write(intfhdl, addr, cnt, tmpbuf);
>  
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 7cb0c6f22..0ae7b6389 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -1430,13 +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);
>  

Extra blank line.

regards,
dan carpenter

>  	if (ielen < RSN_HEADER_LEN) {
>  		ret  = -1;
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v6] staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie
  2026-03-04 13:59 ` [PATCH v4] staging: rtl8723bs: replace alloc+memcpy " Alexandru Hossu
  2026-03-04 14:48   ` Greg KH
@ 2026-03-05 10:23   ` Alexandru Hossu
  2026-03-05 10:39     ` Dan Carpenter
  1 sibling, 1 reply; 9+ messages in thread
From: Alexandru Hossu @ 2026-03-05 10:23 UTC (permalink / raw)
  To: gregkh; +Cc: dan.carpenter, linux-staging, linux-kernel, hossu.alexandru

Replace open-coded kzalloc()+memcpy() with kmemdup() to simplify the code.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
---
v6:
  - Rebase onto staging-next.
  - Limit changes to ioctl_cfg80211.c since sdio_ops.c is already fixed there.
  - Place version notes below the --- line (canonical patch format).

 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 47cba32375d9..453ba1db773f 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.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v6] staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie
  2026-03-05 10:23   ` [PATCH v6] staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie Alexandru Hossu
@ 2026-03-05 10:39     ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2026-03-05 10:39 UTC (permalink / raw)
  To: Alexandru Hossu; +Cc: gregkh, linux-staging, linux-kernel

On Thu, Mar 05, 2026 at 11:23:18AM +0100, Alexandru Hossu wrote:
> Replace open-coded kzalloc()+memcpy() with kmemdup() to simplify the code.
> 
> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
> ---
> v6:
>   - Rebase onto staging-next.
>   - Limit changes to ioctl_cfg80211.c since sdio_ops.c is already fixed there.
>   - Place version notes below the --- line (canonical patch format).
> 

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-03-05 10:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 13:07 [PATCH v2] staging: rtl8723bs: replace kzalloc/kmalloc+memcpy with kmemdup Alexandru Hossu
2026-03-04 13:24 ` Greg KH
2026-03-04 13:51 ` [PATCH v3] " Alexandru Hossu
2026-03-04 13:59 ` [PATCH v4] staging: rtl8723bs: replace alloc+memcpy " Alexandru Hossu
2026-03-04 14:48   ` Greg KH
2026-03-05 10:23   ` [PATCH v6] staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie Alexandru Hossu
2026-03-05 10:39     ` Dan Carpenter
2026-03-05  1:09 ` [PATCH v5] staging: rtl8723bs: replace alloc+memcpy with kmemdup Alexandru Hossu
2026-03-05  5:51   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox