rtw89: fix potentially access out of range of RF register array
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 19 Nov 2021 05:57:29 +0000 (13:57 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 26 Nov 2021 16:13:03 +0000 (18:13 +0200)
commit30101812a09b37bc8aa409a83f603d4c072198f2
treefdba5ca742e9dede075d42cdcfa4d7ea1401cb17
parent43863efeada6eda380bd08537d1e4719341dc50d
rtw89: fix potentially access out of range of RF register array

The RF register array is used to help firmware to restore RF settings.
The original code can potentially access out of range, if the size is
between (RTW89_H2C_RF_PAGE_SIZE * RTW89_H2C_RF_PAGE_NUM + 1) to
((RTW89_H2C_RF_PAGE_SIZE + 1) * RTW89_H2C_RF_PAGE_NUM). Fortunately,
current used size doesn't fall into the wrong case, and the size will not
change if we don't update RF parameter.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211119055729.12826-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/phy.c