Message ID | Y+tapzerW7h9vMvp@zn.tnic |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2873803wrn; Tue, 14 Feb 2023 01:58:01 -0800 (PST) X-Google-Smtp-Source: AK7set+iPhDETomCSMQgWArX2h+onzbqzjx3is69h2lIRHPQ4fIFCBQn926d8WOdKRX/WSxDcsnT X-Received: by 2002:a50:d694:0:b0:4ac:b858:37b1 with SMTP id r20-20020a50d694000000b004acb85837b1mr1908766edi.7.1676368681220; Tue, 14 Feb 2023 01:58:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676368681; cv=none; d=google.com; s=arc-20160816; b=0t8nUW59yxG1U8M6YJSOhp+s4wRuCHpBaIfD9Ees1+Z4vJC8nnxjkeTdx6y3GCFeDO 7xORyxjLTVEkVNGiyR/n59ctIVvNl9az0GtiIIcJXeOSAy0/XIpEoHpbezx1F7YodQPz 2zrYxDL3nTnoiY6TqbSAmJ7QQgxFXNmRKyULRtp+2IWQp65KW96My8FazlY+hpGo4d0E JDIrpSf/N/iLuuTj9jWK1hD9RlZoufrWsfsO7qkqXaon74rpok8wrhwa4XAfXGCPXZoA b0Qm/Y9tjf5YyzrYnWWskhuM4LiC1pg9UK2amclA2B4pQcsoi7IOZGv4ODnmjmazsKQ9 Qhmw== 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=7bGRbUp7nNCsFOKn55St1JRiQ7BHq/0aoTgf8q6Qdcg=; b=w7TPqPOGnhE1Fvjt+e/niPtN70p4CGZc7Gr+N9LkDP5K4h/OGTVmF4LJDlXgM23Vvc LjeSrZ4/A7m4tFU+eDU12+abYbKBWPvFnM7WnodX4BBPW9S/EvhvhUXjn992c0XOf89t 2MeytYa4Ow2H3pT4bAU4Xux/UD4uMDhEEjVNjkgqixwkY9pZLen/U4+E3F81u4C/mtPM Y7oioCuYddqNmYBIz7RLyKGRG6oihjBBxfEj9RRA/m4btZ0pvJNUEgJ0W7oMdiTOYELW ROAPjJT9nCu8Qcp1VdE0XWqW4z4617GgZwZyKHXl3Q5jFdnkKlGN0Y2RM0/rjrmZQ4cl 7p+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=brj3WGeQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t17-20020aa7d711000000b004accbc7602bsi5368612edq.235.2023.02.14.01.57.38; Tue, 14 Feb 2023 01:58:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@alien8.de header.s=dkim header.b=brj3WGeQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbjBNJ4x (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Tue, 14 Feb 2023 04:56:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjBNJ4N (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Feb 2023 04:56:13 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA57C24CBC; Tue, 14 Feb 2023 01:55:56 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 41AAC1EC08BF; Tue, 14 Feb 2023 10:55:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1676368555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=7bGRbUp7nNCsFOKn55St1JRiQ7BHq/0aoTgf8q6Qdcg=; b=brj3WGeQt/qR1+3ctwqUSDvLiiFOcRdh+U2yuK+3YmtuOFLRxo6Zp9gHCyWYc1dEbWf930 fGU/A1tLO0rcqglT/GSCKj9KDA1pCuIzLd9dL30vt5PAjSJz1kPzNOhIgnUoj3t3tQfkGp fZkI0WvJQQvMIBqWGCW4023Od/cwuuA= Date: Tue, 14 Feb 2023 10:55:51 +0100 From: Borislav Petkov <bp@alien8.de> To: Nathan Chancellor <nathan@kernel.org> Cc: Yazen Ghannam <yazen.ghannam@amd.com>, Tom Rix <trix@redhat.com>, tony.luck@intel.com, james.morse@arm.com, mchehab@kernel.org, rric@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] EDAC/amd64: Shut up an -Werror,-Wsometimes-uninitialized clang false positive Message-ID: <Y+tapzerW7h9vMvp@zn.tnic> References: <20230213191510.2237360-1-trix@redhat.com> <Y+qZthCMRL1m0p4B@yaz-fattaah> <Y+qcU2M5gchfzbky@zn.tnic> <Y+qdVHidnrrKvxiD@dev-arch.thelio-3990X> <03b91ce8-c6d0-63e7-561c-8cada0ece2fe@redhat.com> <Y+q1mhrAKTobp3fa@yaz-fattaah> <Y+q2pXYI02qAje8N@dev-arch.thelio-3990X> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <Y+q2pXYI02qAje8N@dev-arch.thelio-3990X> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757799966399850205?= X-GMAIL-MSGID: =?utf-8?q?1757799966399850205?= |
Series |
EDAC/amd64: Shut up an -Werror,-Wsometimes-uninitialized clang false positive
|
|
Commit Message
Borislav Petkov
Feb. 14, 2023, 9:55 a.m. UTC
From: Yazen Ghannam <yazen.ghannam@amd.com> Yeah, the code's fine even without this. What this is fixing is a compiler which is overeager to report false positives which then get automatically enabled in -Wall builds and when CONFIG_WERROR is set in allmodconfig builds, the build fails. It doesn't happen with gcc. Maybe clang should be more conservative when enabling such warnings under -Wall as, apparently, this has an impact beyond just noisy output. [ bp: Write a commit message. ] Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/Y%2BqdVHidnrrKvxiD@dev-arch.thelio-3990X --- drivers/edac/amd64_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Feb 14, 2023 at 10:55:51AM +0100, Borislav Petkov wrote: > From: Yazen Ghannam <yazen.ghannam@amd.com> > > Yeah, the code's fine even without this. > > What this is fixing is a compiler which is overeager to report false > positives which then get automatically enabled in -Wall builds and when > CONFIG_WERROR is set in allmodconfig builds, the build fails. > > It doesn't happen with gcc. > > Maybe clang should be more conservative when enabling such warnings > under -Wall as, apparently, this has an impact beyond just noisy output. For the record, this is the first false positive that I have seen from this warning in quite some time. You can flip through our issue tracker and see how many instances of the uninitialized warnings there have been and the vast majority of the ones in 2022 at least are all true positives: https://github.com/ClangBuiltLinux/linux/issues?q=label%3A-Wsometimes-uninitialized%2C-Wuninitialized So I disagree with the characterization that clang is "overeager to report false positives" and I think the opinionated parts of the commit message could be replaced with some of the technical analysis that Tom and I did to show why this is a false positive but not one clang can reason about with the way the code is structured (since the warning does not perform interprocedural analysis). However, not my circus, not my monkeys, so feel free to ignore all this :) Regardless, my review still stands and thank you again for the fix. Cheers, Nathan > [ bp: Write a commit message. ] > > Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> > Reviewed-by: Nathan Chancellor <nathan@kernel.org> > Link: https://lore.kernel.org/r/Y%2BqdVHidnrrKvxiD@dev-arch.thelio-3990X > --- > drivers/edac/amd64_edac.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c > index 1c4bef1cdf28..5b42533f306a 100644 > --- a/drivers/edac/amd64_edac.c > +++ b/drivers/edac/amd64_edac.c > @@ -3928,7 +3928,7 @@ static const struct attribute_group *amd64_edac_attr_groups[] = { > > static int hw_info_get(struct amd64_pvt *pvt) > { > - u16 pci_id1, pci_id2; > + u16 pci_id1 = 0, pci_id2 = 0; > int ret; > > if (pvt->fam >= 0x17) { > -- > 2.35.1 > > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette
On Tue, Feb 14, 2023 at 07:32:36AM -0700, Nathan Chancellor wrote: > On Tue, Feb 14, 2023 at 10:55:51AM +0100, Borislav Petkov wrote: > > From: Yazen Ghannam <yazen.ghannam@amd.com> > > > > Yeah, the code's fine even without this. > > > > What this is fixing is a compiler which is overeager to report false > > positives which then get automatically enabled in -Wall builds and when > > CONFIG_WERROR is set in allmodconfig builds, the build fails. > > > > It doesn't happen with gcc. > > > > Maybe clang should be more conservative when enabling such warnings > > under -Wall as, apparently, this has an impact beyond just noisy output. > > For the record, this is the first false positive that I have seen from > this warning in quite some time. You can flip through our issue tracker > and see how many instances of the uninitialized warnings there have been > and the vast majority of the ones in 2022 at least are all true > positives: > > https://github.com/ClangBuiltLinux/linux/issues?q=label%3A-Wsometimes-uninitialized%2C-Wuninitialized > > So I disagree with the characterization that clang is "overeager to > report false positives" and I think the opinionated parts of the commit > message could be replaced with some of the technical analysis that Tom > and I did to show why this is a false positive but not one clang can > reason about with the way the code is structured (since the warning does > not perform interprocedural analysis). However, not my circus, not my > monkeys, so feel free to ignore all this :) > > Regardless, my review still stands and thank you again for the fix. > Thanks Nathan for the feedback and thanks Boris for the patch. Nathan, I see there's a ClangBuiltLinux/continuous-integration2 project on github. Is this something developers should try to leverage? Maybe just fork it and update the action/workflows to use test branches? Thanks, Yazen
On Tue, Feb 14, 2023 at 03:04:35PM +0000, Yazen Ghannam wrote: > On Tue, Feb 14, 2023 at 07:32:36AM -0700, Nathan Chancellor wrote: > > On Tue, Feb 14, 2023 at 10:55:51AM +0100, Borislav Petkov wrote: > > > From: Yazen Ghannam <yazen.ghannam@amd.com> > > > > > > Yeah, the code's fine even without this. > > > > > > What this is fixing is a compiler which is overeager to report false > > > positives which then get automatically enabled in -Wall builds and when > > > CONFIG_WERROR is set in allmodconfig builds, the build fails. > > > > > > It doesn't happen with gcc. > > > > > > Maybe clang should be more conservative when enabling such warnings > > > under -Wall as, apparently, this has an impact beyond just noisy output. > > > > For the record, this is the first false positive that I have seen from > > this warning in quite some time. You can flip through our issue tracker > > and see how many instances of the uninitialized warnings there have been > > and the vast majority of the ones in 2022 at least are all true > > positives: > > > > https://github.com/ClangBuiltLinux/linux/issues?q=label%3A-Wsometimes-uninitialized%2C-Wuninitialized > > > > So I disagree with the characterization that clang is "overeager to > > report false positives" and I think the opinionated parts of the commit > > message could be replaced with some of the technical analysis that Tom > > and I did to show why this is a false positive but not one clang can > > reason about with the way the code is structured (since the warning does > > not perform interprocedural analysis). However, not my circus, not my > > monkeys, so feel free to ignore all this :) > > > > Regardless, my review still stands and thank you again for the fix. > > > > Thanks Nathan for the feedback and thanks Boris for the patch. > > Nathan, > I see there's a ClangBuiltLinux/continuous-integration2 project on github. > Is this something developers should try to leverage? Maybe just fork it and > update the action/workflows to use test branches? Our continuous integration relies on TuxSuite [1], which in turn requires access to their service. TuxMake [2] is the backend for TuxSuite, which is what I use doing a lot of my build testing. It can use your local toolchains or it can use Docker/Podman to build in their curated containers, which have a wide variety of versions, if that matters to you. I have thought about writing a wrapper around tuxmake to build our TuxSuite configurations (the tuxsuite/ folder within our repo) locally, maybe this is time to do so :) it would be useful to have something like $ scripts/build-local.py tuxsuite/tip-clang-15.yml tuxsuite/tip-clang-16.yml which would allow people to easily test the configurations that we generally care about for -tip with recent/stable versions of clang/LLVM. Otherwise, a simple $ tuxmake -a x86_64 -k allmodconfig -t llvm default or $ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 allmodconfig all is generally good enough to catch the majority of problems visible with clang, assuming your distribution has a version of LLVM that the kernel supports (11.x+). [1]: https://tuxsuite.com [2]: https://tuxmake.org Cheers, Nathan
On Tue, Feb 14, 2023 at 07:32:36AM -0700, Nathan Chancellor wrote: > So I disagree with the characterization that clang is "overeager to > report false positives" and I think the opinionated parts of the commit > message could be replaced with some of the technical analysis that Tom > and I did to show why this is a false positive but not one clang can > reason about with the way the code is structured (since the warning does > not perform interprocedural analysis). I'm sure you can create all kinds of cases like this one if interprocedural analysis or aggressive inlining doesn't happen. So I'm rather surprised that this is the first false positive to happen. But whateva. And since we're disagreeing with things: I don't mind if this is a false positive - I don't care. What I don't agree with is having -Werror fail the build because of it and forcing us to "wag the dog", so to speak. And you can imagine that this has been happening for a while now. And it can explain my reaction to yet another compiler fix. But ok, we've wasted enough time on this, lemme tone down the commit message and commit it. Thx.
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 1c4bef1cdf28..5b42533f306a 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3928,7 +3928,7 @@ static const struct attribute_group *amd64_edac_attr_groups[] = { static int hw_info_get(struct amd64_pvt *pvt) { - u16 pci_id1, pci_id2; + u16 pci_id1 = 0, pci_id2 = 0; int ret; if (pvt->fam >= 0x17) {