Re: [PATCH v2] staging: rtl8723bs: clean up memcpy() in rtw_check_bcn_info
From: Dan Carpenter
Date: Wed Apr 15 2026 - 06:08:37 EST
On Wed, Apr 15, 2026 at 10:56:38AM +0200, luka.gejak@xxxxxxxxx wrote:
> From: Luka Gejak <luka.gejak@xxxxxxxxx>
>
> Move the ssid memcpy() inside the ie null-check to avoid calling it
> with a NULL-derived pointer (p + 2) when the ie is missing.
>
> While the kernel handles 0-length memcpy() safely as a no-op, keeping
> the call outside the check is confusing and poor practice. This
> change improves code readability.
>
> Signed-off-by: Luka Gejak <luka.gejak@xxxxxxxxx>
> ---
> As Dan pointed out kernel handles 0-length memcpy() safely as a no-op
> therefore it doesn't cause kernel oops or panics so in v2 changed commit
> message to move from bugfix to cleanup and removed fixes tag.
Thanks.
Reviewed-by: Dan Carpenter <error27@xxxxxxxxx>
regards,
dan carpenter