[PATCH] staging: rtl8723bs: remove redundant NULL check on premainder_ie

Giorgi Tchankvetadze posted 1 patch 1 month, 3 weeks ago
drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] staging: rtl8723bs: remove redundant NULL check on premainder_ie
Posted by Giorgi Tchankvetadze 1 month, 3 weeks ago
premainder_ie is computed as pwps_ie + wps_ielen, where pwps_ie is
already validated non-NULL earlier in the function. Pointer arithmetic
on a non-NULL pointer can never yield NULL, making this check always
true and misleading. Replace with a simple check on remainder_ielen.

Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index ebe73abab892..2b28c5fd436b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1439,7 +1439,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
 
 	remainder_ielen = ielen - wps_offset - wps_ielen;
 
-	if (premainder_ie && remainder_ielen)
+	if (remainder_ielen)
 		pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC);
 
 	wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
-- 
2.52.0
Re: [PATCH] staging: rtl8723bs: remove redundant NULL check on premainder_ie
Posted by Ethan Tidmore 1 month, 3 weeks ago
On Sat Feb 21, 2026 at 6:47 AM CST, Giorgi Tchankvetadze wrote:
> premainder_ie is computed as pwps_ie + wps_ielen, where pwps_ie is
> already validated non-NULL earlier in the function. Pointer arithmetic
> on a non-NULL pointer can never yield NULL, making this check always
> true and misleading. Replace with a simple check on remainder_ielen.
>
> Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
> ---

LGTM.

Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>

Thanks,

ET