Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp498542pxx; Wed, 28 Oct 2020 09:41:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDCJEOgtsuEFLmvb5oSwEPSOCvK58Co/dJyXPxx7ArHcmjg8EnbszjYcNufRrz1z8/f4j1 X-Received: by 2002:a05:6402:17e4:: with SMTP id t4mr8874171edy.118.1603903279971; Wed, 28 Oct 2020 09:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903279; cv=none; d=google.com; s=arc-20160816; b=Vlh6WH4hwpsK8yl8QvLM8ZHvwHFZtEvxPMO5PSw3ltDU7nQ49TaKiYr1R89q+sfyEh JRy3/JteXM01kUIqb5hAaTBoNqJ5uOsNzEWEHppVjS12nGR7q2fu4wfXflyioyuHQn6A Zub1qOdCJPhw41+2WxJMBLt4aOywYD/fIf5POmcfuLLVZnvDo2510kIYBHIbagu3DrZq LgyW71Y3LR5JIspXdskyPAcaCYichNrFu9OqwBMvXNTBdtErMz2MJ5KKMFEJDlIcEqJo 84o8yaWJpLN1kAOXWOehryDBCA6vgCHuRj5br4gDDQjgajb/LKZxihB7WQzajoihPbDm Kj3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=60ZWTB1nKhNcfiBSrUJ8aS5y9g0x2fRPtCKf9hR4F2M=; b=ZqduheSgA3h+61v/Ny3YtlP+B2Ob5Uj5Fe4YH1iOB6XZHaaCDgYY/gx1rBnV7Vt6iW ees43jHFDi4Eqgvnj78AJuBZrG1SsaqwcGfohQs8UMFKTxLL23Ef8Faw37ixEyYr/LFm 56M+RPGIcvggWyOHcW0BB7t9OqCiiT4bLanA+WEfbEoKk+8ozyLuftZe7Za6OAUnbYjX XU8Qwm+XMKnyK4D4jPYJ2o2VEoC3pv4QsBjejcn5KXQShE5Fbr55M+XJB/w7AW4cwKQY WeitTEak4zCxEL4k1B+SMSIRdK6c+vmDuw79+/4+Fp1BEdxhaiJCBgnPokr/ujhRi72l c60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="G4l/Qoo3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm13si21671edb.281.2020.10.28.09.40.56; Wed, 28 Oct 2020 09:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="G4l/Qoo3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1818162AbgJ0RRt (ORCPT + 99 others); Tue, 27 Oct 2020 13:17:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:58404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1782664AbgJ0O50 (ORCPT ); Tue, 27 Oct 2020 10:57:26 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA76D206F4; Tue, 27 Oct 2020 14:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810646; bh=UWr4wPpyxu7N3R5jCcmk+38FTMkchOt8V9CBURqwrXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4l/Qoo3UVC8FZpPbuMo0DwdMIs05O6qAJyWUpdvURCu9fkCv7ki5OpJR/PRrr3+e 4wonbm1fWV7Wu4K6b78COo1EnnT4aZTyfV2gVOliVfHIpSqj6N3lQ+VQvQ8Plnwugq 4ALHxxGZ/YFnfxStpfc+cNGprt3XvNyR/xkVxbLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Yan-Hsuan Chuang , Kalle Valo , Sasha Levin Subject: [PATCH 5.8 182/633] rtw88: dont treat NULL pointer as an array Date: Tue, 27 Oct 2020 14:48:45 +0100 Message-Id: <20201027135531.228745289@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Norris [ Upstream commit 22b726cbdd09d9891ede8aa122a950d2d0ae5e09 ] 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") Signed-off-by: Brian Norris Acked-by: Yan-Hsuan Chuang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200821211716.1631556-1-briannorris@chromium.org Signed-off-by: Sasha Levin --- 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 8d93f31597469..9687b376d221b 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; -- 2.25.1