Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp990968rwe; Wed, 24 Aug 2022 12:42:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ak+CsPb6RfLMu/ouZLEvtYO0rjTNRfl19v4j9vdmBwtKSUDMsS0cCMfSMW2fUx6EmEzeG X-Received: by 2002:a62:158b:0:b0:536:460d:80a5 with SMTP id 133-20020a62158b000000b00536460d80a5mr658777pfv.26.1661370140411; Wed, 24 Aug 2022 12:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661370140; cv=none; d=google.com; s=arc-20160816; b=QyfHL+2lQ74gwwBbc/4cjgaoZbCwcUa/rGqJy3CIVJJthqJdGmL0b55mOCpzdVys3q Qu7XRuRYmzQqJmicyQdaei/KvCz7eDzRpw3lxlKT4Vfg30xPwFWdB6Po/tiuJW8Av4Jp Lvk/2zWHckqjBHunZCtQvGbRmW2PH7P7zi0F4N+skCh/blmYSIKqPQKvdib1ws5nFPyo rIKa4HgticLk3HJeMlPR14cl0vD11TesFljaUSiz+AsmDRJfyxe20Bagmm6Dz42ul+36 kE/Q+JLa98S2TiweuT7Xz1eY8LTQ3AkrCapiX0dAC6o1oQfZtJ8hb8fVPB0rIlLCiJXB gEPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LVjobDA29qsjXQKqd5+MRhXtJzES20K7ovQWGWAJ5Sc=; b=v5CIQB1KiZOFsHCEVrH97jkbh0Eay/04Am4EJGy1SxX2fxeWyEcfqGaeaVqdEb5kjf 2xpVJszLbNeUokPE+rLjaTdLFjWf9PJR69KmGONmkkAyFYkVIFkiDKsWQieortEdvf2q +UjCF8VdvVEegZTbhxOMss1mqHXh2NE0sIOw5xveKrrh8ApW9mwBqEhzG9uteJa3EgYo a3Xe31d2heFJAERce5G/2/5OGoEOOP4QmBo0yOBgtj8vMvnUVsMmd+J0JXI27RFlBvuX 234oLcfu0bi927RGZb3Qg/tpYVRos0wv3cvNZLR0LdttzPFdqI5OlF32nZJ/UiMy2gZs eScQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VnM8BYNv; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a17090a74ca00b001f068e76032si1839218pjl.171.2022.08.24.12.42.06; Wed, 24 Aug 2022 12:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VnM8BYNv; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239365AbiHXTi4 (ORCPT + 63 others); Wed, 24 Aug 2022 15:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239293AbiHXTiy (ORCPT ); Wed, 24 Aug 2022 15:38:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53591792E1 for ; Wed, 24 Aug 2022 12:38:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6BC4B8262C for ; Wed, 24 Aug 2022 19:38:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43EFAC433C1; Wed, 24 Aug 2022 19:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661369928; bh=R4hfsdp6uroBMrUMR69RZsiOlaN6utlNy+v5ZpGfvgI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VnM8BYNvJ3y80vZ1pnymZP99kITzdjDzOsxjAnVk7lkEVkqMev87N7epMndF94wKw k+2zle/3UNJ5yWLpmaJrt6IwzB+ih0OmcKTaHAwUPmSkZ5yDRC+wNh0qoGDCltUr3n YhnngFaGSSyOyBlPoi3xfl2kAvg7CyrB3Hl+p0/5Wl1gV9dXHXS70veQMToMwPT3Ax gxBwWJnyRuHQf00AB94H+v+AzV0ojIhxFLCih8tl+a2cug3Oy4ss1FfAlUIaebmt9r 4/bWNkyVXTvpVrdJkJGfcRmn0r+/W3K0uoz7otvbiQUx+16prKLn3jgmW1dxSjCL3C QhIuF8ReRk5Ww== Date: Wed, 24 Aug 2022 12:38:46 -0700 From: Nathan Chancellor To: Ping-Ke Shih Cc: tony0620emma@gmail.com, kvalo@kernel.org, linux-wireless@vger.kernel.org Subject: Re: [PATCH] wifi: rtw88: fix uninitialized use of primary channel index Message-ID: References: <20220815062004.22920-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220815062004.22920-1-pkshih@realtek.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, Aug 15, 2022 at 02:20:04PM +0800, Ping-Ke Shih wrote: > clang reports uninitialized use: > > >> drivers/net/wireless/realtek/rtw88/main.c:731:2: warning: variable > 'primary_channel_idx' is used uninitialized whenever switch default is > taken [-Wsometimes-uninitialized] > default: > ^~~~~~~ > drivers/net/wireless/realtek/rtw88/main.c:754:39: note: uninitialized > use occurs here > hal->current_primary_channel_index = primary_channel_idx; > ^~~~~~~~~~~~~~~~~~~ > drivers/net/wireless/realtek/rtw88/main.c:687:24: note: initialize the > variable 'primary_channel_idx' to silence this warning > u8 primary_channel_idx; > ^ > = '\0' > > This situation could not happen, because possible channel bandwidth > 20/40/80MHz are enumerated. > > Fixes: 341dd1f7de4c ("wifi: rtw88: add the update channel flow to support setting by parameters") > Reported-by: kernel test robot > Signed-off-by: Ping-Ke Shih Reviewed-by: Nathan Chancellor Can we get this into -next soon? This warning is breaking our builds due to CONFIG_WERROR. > --- > drivers/net/wireless/realtek/rtw88/main.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c > index 790dcfed1125d..5a74dda977563 100644 > --- a/drivers/net/wireless/realtek/rtw88/main.c > +++ b/drivers/net/wireless/realtek/rtw88/main.c > @@ -697,6 +697,7 @@ void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel, > > switch (bandwidth) { > case RTW_CHANNEL_WIDTH_20: > + default: > primary_channel_idx = RTW_SC_DONT_CARE; > break; > case RTW_CHANNEL_WIDTH_40: > @@ -728,8 +729,6 @@ void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel, > cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_channel - 4; > } > break; > - default: > - break; > } > > switch (center_channel) { > -- > 2.25.1 > >