Skip to content

Commit 37f1220

Browse files
Dan Carpentergregkh
authored andcommitted
staging: r8188eu: prevent array underflow in rtw_hal_update_ra_mask()
The problem is that "mac_id" is a u32 so this check for underflow does not work when "mac_id" is zero. In that situation, "mac_id - 1" is UINT_MAX instead of -1 so the condition is true. It leads to an array underflow on the next line. Fixes: 8cd574e ("staging: r8188eu: introduce new hal dir for RTL8188eu driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210930122604.GB10068@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7ff4034 commit 37f1220

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/staging/r8188eu/hal/hal_intf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void rtw_hal_update_ra_mask(struct adapter *adapt, u32 mac_id, u8 rssi_level)
248248
#ifdef CONFIG_88EU_AP_MODE
249249
struct sta_info *psta = NULL;
250250
struct sta_priv *pstapriv = &adapt->stapriv;
251-
if ((mac_id - 1) > 0)
251+
if (mac_id >= 2)
252252
psta = pstapriv->sta_aid[(mac_id - 1) - 1];
253253
if (psta)
254254
add_RATid(adapt, psta, 0);/* todo: based on rssi_level*/

0 commit comments

Comments
 (0)