From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 775F1C43217 for ; Fri, 21 Oct 2022 10:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiJUKs2 (ORCPT ); Fri, 21 Oct 2022 06:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbiJUKsZ (ORCPT ); Fri, 21 Oct 2022 06:48:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173F525F1F4; Fri, 21 Oct 2022 03:48:23 -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 5B35AB82B95; Fri, 21 Oct 2022 10:48:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7943C433B5; Fri, 21 Oct 2022 10:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666349301; bh=Yl3qRQQpWdMPUbGxJERyNc/a/LusWFS2QJF+ezf+FSQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TgA9vbS6vmkee+djXhez8XsX6q6q1k2rY96M7LgzmPrdDZPi5mQ6jF/HZBcaB7ySU j8m64Y7onysoEui/gN8yxtcBzMLgXCrmYn6oRiTicigWyuHey2t6Auz21mRvYeqpS5 fpN/oagLoQJJi25vqOB90BmrTDzvB8MJl+/zuRLSdckp2f1e+iemccjiKzuDF9/ylz rLREgmw9skT4GXZwRZSS3HUvqxq59RRVIjQGYf/7aEycG3OCnepfg1pF2lwqEkR/sO fKbdssWhwxeVuoQ/Ge0+keJL7SqL0oMs9a+yj0bntYMeqVElqeHoOz+zaOoD888Khx 6QW13DEahU5hw== From: Kalle Valo To: Colin Ian King Cc: Jes Sorensen , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bitterblue Smith , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] wifi: rtl8xxxu: Fix reads of uninitialized variables hw_ctrl_s1, sw_ctrl_s1 References: <20221020135709.1549086-1-colin.i.king@gmail.com> <87ilkdlq48.fsf@kernel.org> Date: Fri, 21 Oct 2022 13:48:11 +0300 In-Reply-To: <87ilkdlq48.fsf@kernel.org> (Kalle Valo's message of "Fri, 21 Oct 2022 08:09:27 +0300") Message-ID: <87bkq51mhg.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Kalle Valo writes: > Colin Ian King writes: > >> Variables hw_ctrl_s1 and sw_ctrl_s1 are not being initialized and >> potentially can contain any garbage value. Currently there is an if >> statement that sets one or the other of these variables, followed >> by an if statement that checks if any of these variables have been >> set to a non-zero value. In the case where they may contain >> uninitialized non-zero values, the latter if statement may be >> taken as true when it was not expected to. >> >> Fix this by ensuring hw_ctrl_s1 and sw_ctrl_s1 are initialized. >> >> Cleans up clang warning: >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:432:7: warning: >> variable 'hw_ctrl_s1' is used uninitialized whenever 'if' condition is >> false [-Wsometimes-uninitialized] >> if (hw_ctrl) { >> ^~~~~~~ >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:440:7: note: uninitialized >> use occurs here >> if (hw_ctrl_s1 || sw_ctrl_s1) { >> ^~~~~~~~~~ >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c:432:3: note: remove the 'if' >> if its condition is always true >> if (hw_ctrl) { >> ^~~~~~~~~~~~~ >> >> Fixes: c888183b21f3 ("wifi: rtl8xxxu: Support new chip RTL8188FU") >> Signed-off-by: Colin Ian King > > I'll queue this to v6.1. Actually commit c888183b21f3 is in wireless-next so this patch should go to wireless-next, for v6.2. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches