]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
staging: rtl8723bs: replace ternary min comparison with min()
authorWilliam Hansen-Baird <william.hansen.baird@gmail.com>
Sat, 7 Feb 2026 22:01:36 +0000 (17:01 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Feb 2026 14:39:55 +0000 (15:39 +0100)
commitcd3589550059d43a27d613021c626ba6ead7334e
treec2abe7695437f9edd475fbced0e9e66930b8c7a3
parentc18828f2f8a8846ccba17a1546766fd56e9dd750
staging: rtl8723bs: replace ternary min comparison with min()

Change type of local variable wpa_ie_len from int to u8.
wpa_ie_len gets its value either from elems->wpa_ie_len or
elems->rsn_ie_len which are both u8, and thus there's no reason
to cast them to int.

This allows rewriting ternary min comparison using the min() function from
linux/minmax.h as now both sides are unsigned.

Rewrite as well wpa_ie_len + 2 to wpa_ie_len + 2u,
to keep the expression unsigned and avoid overflows.

Signed-off-by: William Hansen-Baird <william.hansen.baird@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20260207220136.67923-1-william.hansen.baird@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c