rtw88: fix subscript above array bounds compiler warning
authorStanislaw Gruszka <sgruszka@redhat.com>
Mon, 6 May 2019 07:39:17 +0000 (09:39 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 28 May 2019 11:29:30 +0000 (14:29 +0300)
commit8a03447dd311da2ad2df74dcf730a1a15f673379
tree4eff6c6059d0cfe38033e43922fb7dc78628e637
parent3e66b7cc50ef921121babc91487e1fb98af1ba6e
rtw88: fix subscript above array bounds compiler warning

My compiler complains about:

drivers/net/wireless/realtek/rtw88/phy.c: In function ‘rtw_phy_rf_power_2_rssi’:
drivers/net/wireless/realtek/rtw88/phy.c:430:26: warning: array subscript is above array bounds [-Warray-bounds]
  linear = db_invert_table[i][j];

According to comment power_db should be in range 1 ~ 96 .
To fix add check for boundaries before access the array.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtw88/phy.c