Re: [PATCH] staging: rtl8723bs: replace kmalloc + memcpy with kmemdup in ioctl_cfg80211.c

From: Greg Kroah-Hartman

Date: Sat Mar 14 2026 - 06:00:56 EST


On Sat, Mar 14, 2026 at 10:11:39AM +0100, Tomasz Unger wrote:
> Replace kmalloc() followed by memcpy() with kmemdup() which combines
> both operations into a single call, making the code cleaner and more
> readable. The zeroing done by kzalloc() is unnecessary here as the
> entire buffer is immediately overwritten by memcpy().
>
> Signed-off-by: Tomasz Unger <tomasz.unger@xxxxxxxx>
> ---
> Verified with checkpatch.pl - no errors or warnings.
> Compiled the rtl8723bs module successfully.
> Tested by loading the module in a QEMU environment - module loads
> successfully with no errors.

Loading a module doesn't do anything (you can do that on a raspberrypi),
you have to have the hardware to bind to the driver and actually call
the ioctl to verify it works. So while loading is nice, you didn't
actually exercise your change at all :(

Not to say this change is not correct, just be a bit more careful as to
how you attempt to test this please.

thanks,

greg k-h