Skip to content

Commit 9296dcc

Browse files
computersforpeacegregkh
authored andcommitted
rtw88: don't treat NULL pointer as an array
[ Upstream commit 22b726c ] I'm not a standards expert, but this really looks to be undefined behavior, when chip->dig_cck may be NULL. (And, we're trying to do a NULL check a few lines down, because some chip variants will use NULL.) Fixes: fc637a8 ("rtw88: 8723d: Set IG register for CCK rate") Signed-off-by: Brian Norris <briannorris@chromium.org> Acked-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200821211716.1631556-1-briannorris@chromium.org Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f09ff7a commit 9296dcc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • drivers/net/wireless/realtek/rtw88

drivers/net/wireless/realtek/rtw88/phy.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@ void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi)
147147
{
148148
struct rtw_chip_info *chip = rtwdev->chip;
149149
struct rtw_hal *hal = &rtwdev->hal;
150-
const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0];
151150
u32 addr, mask;
152151
u8 path;
153152

154-
if (dig_cck)
153+
if (chip->dig_cck) {
154+
const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0];
155155
rtw_write32_mask(rtwdev, dig_cck->addr, dig_cck->mask, igi >> 1);
156+
}
156157

157158
for (path = 0; path < hal->rf_path_num; path++) {
158159
addr = chip->dig[path].addr;

0 commit comments

Comments
 (0)