Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1851758pxa; Sun, 23 Aug 2020 19:34:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhfadDDSTVoiA5d/ob5aH+gLqW+IXcUXF2jTYv4ciF8qCbokv6VvF3M8FKn0Xgj9RIkNxM X-Received: by 2002:aa7:c4d4:: with SMTP id p20mr3369858edr.154.1598236443954; Sun, 23 Aug 2020 19:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598236443; cv=none; d=google.com; s=arc-20160816; b=ti0FkXJ208yBM+dD4nz6UyfK1VGcDIxElW1CpXrtcx/L5X6zm2YgnGFIcxzTwcUgRm BG5xI6UdR8PPZASf+N0ZdhMYPm7qSOYmYolAwiSDdaSn22Gwy1byZGUn7hxnebMue7ai aotV/k23hCjKm1SZtJqvaICoi5GJ0do5mOzQJrJHb+jKf0+FU7yVOL5aiMdtFpQelHLt x2vtHpttF3uM+KFNfLxnvol6qoK7m1J6MirULjOe5scix6PfbWM1txrzI2en6vJne1m2 G8mEMbIrdQJJhCgjddyJpEPLQo4iWPBMZyD7747g79EZU4N5HiCZAQ0A4RhKV5HhLhw6 zayA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from:authenticated-by; bh=U3N+FlgXa7RoCNKYv+pdjeI/uUsNWpkOZehPER5VE+I=; b=x9r8YLlWU+59LRtJipCw2wVArF0GCEqCl5JggYU8A5UPjEPn+dWHH0awGRoZBZgUVJ FPtgxIKct/EFaL+aHWjRH+O4Fgsf1XtvhDB9R318xRq4pqpkDtLN33ID58RzUiFmEb0n +17eTg28VIK7jR39ILoCc1aEX7TVJDoqdWIhPTP+pNpxulFBExiUA31m66MKTkdQDycc 9/D3FxAN5nLJmhuZdczlr0U9VIpdc51gSKjxjvP2slh33WTGWcN3ddREN2d+9sDxSm72 RicNpddN35HEBfji7A5SITnOvBdZfZnkJaQBj5GJxKFGwnS6qUYYzZ9rg9LrSjNXBwQb 7Oaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c60si6154928edd.128.2020.08.23.19.33.24; Sun, 23 Aug 2020 19:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgHXBug convert rfc822-to-8bit (ORCPT + 99 others); Sun, 23 Aug 2020 21:50:36 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:55765 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbgHXBug (ORCPT ); Sun, 23 Aug 2020 21:50:36 -0400 Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.69 with qID 07O1oXPG1003630, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexmb06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.66/5.86) with ESMTPS id 07O1oXPG1003630 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 24 Aug 2020 09:50:33 +0800 Received: from RTEXMB05.realtek.com.tw (172.21.6.98) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 24 Aug 2020 09:50:33 +0800 Received: from RTEXMB04.realtek.com.tw (172.21.6.97) by RTEXMB05.realtek.com.tw (172.21.6.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 24 Aug 2020 09:50:32 +0800 Received: from RTEXMB04.realtek.com.tw ([fe80::941:6388:7d34:5c44]) by RTEXMB04.realtek.com.tw ([fe80::941:6388:7d34:5c44%3]) with mapi id 15.01.1779.005; Mon, 24 Aug 2020 09:50:32 +0800 From: Tony Chuang To: Brian Norris , "linux-wireless@vger.kernel.org" Subject: RE: [PATCH] rtw88: don't treat NULL pointer as an array Thread-Topic: [PATCH] rtw88: don't treat NULL pointer as an array Thread-Index: AQHWeAB4uJN/vdOmkEGwwlrKe37FlalGgY2A Date: Mon, 24 Aug 2020 01:50:32 +0000 Message-ID: <64d1446a178a48fc997c35b79b5cea23@realtek.com> References: <20200821211716.1631556-1-briannorris@chromium.org> In-Reply-To: <20200821211716.1631556-1-briannorris@chromium.org> Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.68.175] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > > 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: fc637a860a82 ("rtw88: 8723d: Set IG register for CCK rate") Acked-by: Yan-Hsuan Chuang > Signed-off-by: Brian Norris > --- > drivers/net/wireless/realtek/rtw88/phy.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/phy.c > b/drivers/net/wireless/realtek/rtw88/phy.c > index 8d93f3159746..9687b376d221 100644 > --- a/drivers/net/wireless/realtek/rtw88/phy.c > +++ b/drivers/net/wireless/realtek/rtw88/phy.c > @@ -147,12 +147,13 @@ void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 > igi) > { > struct rtw_chip_info *chip = rtwdev->chip; > struct rtw_hal *hal = &rtwdev->hal; > - const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0]; > u32 addr, mask; > u8 path; > > - if (dig_cck) > + if (chip->dig_cck) { > + const struct rtw_hw_reg *dig_cck = &chip->dig_cck[0]; > rtw_write32_mask(rtwdev, dig_cck->addr, dig_cck->mask, igi >> 1); > + } > > for (path = 0; path < hal->rf_path_num; path++) { > addr = chip->dig[path].addr; Thanks. Yen-Hsuan