]> git.baikalelectronics.ru Git - kernel.git/commit
staging: r8188eu: prevent array underflow in rtw_hal_update_ra_mask()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 30 Sep 2021 12:26:04 +0000 (15:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Oct 2021 10:35:30 +0000 (12:35 +0200)
commit3c7729877c3bf1a5dbdaaa1bdb0bbfd129115fa7
tree8886efd5ad1616b153c11f9f2a240aed9dabc57d
parentcf288d5c0fa9128caf41847df8dddcca4ade353e
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: c5fe46ac56f4 ("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>
drivers/staging/r8188eu/hal/hal_intf.c