Message ID | cec62eba-c4b8-4cb7-9671-58894dd4b974@moroto.mountain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1714129vqb; Fri, 13 Oct 2023 00:18:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/Ozhbji9FWKJI5RPdzszroh4Ugij/cSOcOTgu+FiUff53qakGwFUf2Y11d2JQkJAf58JD X-Received: by 2002:a05:6870:164c:b0:1e9:e605:27a1 with SMTP id c12-20020a056870164c00b001e9e60527a1mr494796oae.2.1697181511398; Fri, 13 Oct 2023 00:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697181511; cv=none; d=google.com; s=arc-20160816; b=MwrOGz83EQk/jlbCFOv9efRg/wlYbbkKB2a8DJwrl8mB5iq+a4zrYT4V4tlGZUrO7r HQlgwBwkAQR+acnDAlygmwpmjwUezTSsjuqdW75/vIqoQ4maVLIkzyLBM+55neq8DHaq 0eZGXVcZLceRHoYUNXqOa54+KeyVyvuhVqlv3C6vhr5izg5mBemRu+3ByRMwKbQZe0jl pB5noNY3x9jpcEywMOO3ytTTLzgJh6XMM3VL+znOst/8Nj6ZpjAD5+sqdhbv8hzsQCZk YVTa1z62az6ayn5ceeURFdghQ8R2n1Raxt1TFD9ov6xvFi/9aTW/N6JN/OKn2HQuv7TR 2Uqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=tbVF/4xx0+0vu2fMTNsv16S5m/ukxWZpS5bYJMmX8qM=; fh=hVoVKA2d8B+pivCukHr+P7n7LqwreztFu46bT8cOO4I=; b=qiyrUqN6vzkygcF40+hhH6tBW4B+GSab4Q50aOmcYlC3udPZlMvW7/eHyDI7QykckY uYTn4mHZp3wa8C5Z0VtOFTLJtiJbQH5AkJSZQprf8V2tRxDR1Dhla4MZ8Fos7GXoKqhZ p/biTV7gbCfNIve+uwSji25eW11s0rNbLSuqvXsSV7o/XcAfOzHns0GGMKUO+myyuRvA 3dtclHohoQRdzwX8zz2YYInxJPLD24NqNNHpVVkyMs/HsZarUMuGOeWGxowytbG/I9Bt wv6E2OapG0ZhGD8h9D8lhLF9pJlTRHkJQtHtLCZz70iaHQY7Fg0P8UqUQeRGkMa3gZWd vgLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fQHUhy3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id a21-20020a63e855000000b0054405623a4asi1559883pgk.615.2023.10.13.00.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:18:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fQHUhy3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 59EAC82B2E96; Fri, 13 Oct 2023 00:18:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229699AbjJMHSV (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Fri, 13 Oct 2023 03:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjJMHSU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Oct 2023 03:18:20 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B9AFB8 for <linux-kernel@vger.kernel.org>; Fri, 13 Oct 2023 00:18:17 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32d9b507b00so363718f8f.1 for <linux-kernel@vger.kernel.org>; Fri, 13 Oct 2023 00:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697181496; x=1697786296; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=tbVF/4xx0+0vu2fMTNsv16S5m/ukxWZpS5bYJMmX8qM=; b=fQHUhy3vDUanMdrmzzXVux/ic01wJ2iX9b/aUS3feozz+Q62J5P3f78MZYWrPV4e93 h4VM4iAZmmMqZomxPyD71xCjsghzDsANXlwyFgaX0V2JiN8FhMqgWMnYuB9ROf7uKEz2 9HNGVpZ9XxVDpTmWbJWc5CAOHWUeUGT3/p/WwpjZf3UIgww3spTtLpg7k0Pimswrfuxb YHGMYxQ7z3wM1Py/nCj0Hy6J+9Caq5JN43KL9QNzYWaLgwCs6PtcoZmy3NS/7xG/wWn8 C+o4KWGz7Xvc9/a5hRlJwiD5vZ3hPVuZwRBBLr1Pr4B/+GtRKZsCLmJS6P1Lxuhpfp0J 5MiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697181496; x=1697786296; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tbVF/4xx0+0vu2fMTNsv16S5m/ukxWZpS5bYJMmX8qM=; b=nFeGcqSvMg0dbNjPVN42GlPvytznvn4LZ/O0szcRoIl1xXGPwgtQB9hn6nrQgv8l4J HmLNNGkJpldj9zSqtdCzLyaaFnRXOQYVpm8OEWRCGoOf1XNmF/jewvn76V7dYyi54/58 hP407FQSbX3PUdn+lpN74QT8Vy8kKL1js9UMoMwbKVlIgbR7De4Tk9/WXO7zU+qNuUoA 6a++SnQJuDsGuI+KTNKTPsA/gJVMjt/sD7yDxol0ycxosHCyr+aTsYTpBLyxD3Rxkual KYXlhiJOg2wb4YpQm1Tf6xO2OvepKfj61UQnzXnyp7V/8uM8B20nYSC84TpP8uabXr48 1LMQ== X-Gm-Message-State: AOJu0Yz6TI8BjEMEDhqnVU+NIx2rlq5xC97beJ2y179EfzbTiZ5LhXM4 wQYuEpVlbubBBaFqEroFdrUaIBCX1ZvirliQ5oo= X-Received: by 2002:adf:e542:0:b0:31a:d4e1:ea30 with SMTP id z2-20020adfe542000000b0031ad4e1ea30mr22635389wrm.17.1697181495839; Fri, 13 Oct 2023 00:18:15 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id h12-20020adff18c000000b003232380ffd7sm20203133wro.102.2023.10.13.00.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 00:18:15 -0700 (PDT) Date: Fri, 13 Oct 2023 10:18:12 +0300 From: Dan Carpenter <dan.carpenter@linaro.org> To: Sandipan Das <sandipan.das@amd.com> Cc: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Thomas Gleixner <tglx@linutronix.de>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] perf/x86/amd/uncore: fix error codes in amd_uncore_init() Message-ID: <cec62eba-c4b8-4cb7-9671-58894dd4b974@moroto.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 13 Oct 2023 00:18:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779623800751572647 X-GMAIL-MSGID: 1779623800751572647 |
Series |
perf/x86/amd/uncore: fix error codes in amd_uncore_init()
|
|
Commit Message
Dan Carpenter
Oct. 13, 2023, 7:18 a.m. UTC
Some of the error paths in this function return don't initialize the
error code. Return -ENODEV.
Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
arch/x86/events/amd/uncore.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
* Dan Carpenter <dan.carpenter@linaro.org> wrote: > Some of the error paths in this function return don't initialize the > error code. Return -ENODEV. > > Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > --- > arch/x86/events/amd/uncore.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c > index 9b444ce24108..a389828f378c 100644 > --- a/arch/x86/events/amd/uncore.c > +++ b/arch/x86/events/amd/uncore.c > @@ -1009,7 +1009,8 @@ static struct amd_uncore uncores[UNCORE_TYPE_MAX] = { > static int __init amd_uncore_init(void) > { > struct amd_uncore *uncore; > - int ret, i; > + int ret = -ENODEV; > + int i; > > if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && > boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) Ugh, why on Earth didn't GCC warn about this? The bad pattern is pretty simple & obvious once pointed out ... compilers should have no trouble realizing that 'ret' is returned uninitialized in some of these control paths. Yet not a peep from the compiler ... Thanks for the fix! Ingo
On 10/13/2023 12:48 PM, Dan Carpenter wrote: > Some of the error paths in this function return don't initialize the > error code. Return -ENODEV. > > Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > --- > arch/x86/events/amd/uncore.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c > index 9b444ce24108..a389828f378c 100644 > --- a/arch/x86/events/amd/uncore.c > +++ b/arch/x86/events/amd/uncore.c > @@ -1009,7 +1009,8 @@ static struct amd_uncore uncores[UNCORE_TYPE_MAX] = { > static int __init amd_uncore_init(void) > { > struct amd_uncore *uncore; > - int ret, i; > + int ret = -ENODEV; > + int i; > > if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && > boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) Thanks for catching this. I see that 'ret' remains uninitialized for cases where the hotplug callback registration fails and was thinking if the following is a better fix for this as the reason might not be ENODEV. diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 91f01d6c8f7d..7d768dd01522 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -1039,20 +1039,25 @@ static int __init amd_uncore_init(void) /* * Install callbacks. Core will call them for each online cpu. */ - if (cpuhp_setup_state(CPUHP_PERF_X86_AMD_UNCORE_PREP, - "perf/x86/amd/uncore:prepare", - NULL, amd_uncore_cpu_dead)) + ret = cpuhp_setup_state(CPUHP_PERF_X86_AMD_UNCORE_PREP, + "perf/x86/amd/uncore:prepare", + NULL, amd_uncore_cpu_dead); + if (ret) goto fail; - if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, - "perf/x86/amd/uncore:starting", - amd_uncore_cpu_starting, NULL)) + ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, + "perf/x86/amd/uncore:starting", + amd_uncore_cpu_starting, NULL); + if (ret) goto fail_prep; - if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE, - "perf/x86/amd/uncore:online", - amd_uncore_cpu_online, - amd_uncore_cpu_down_prepare)) + + ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE, + "perf/x86/amd/uncore:online", + amd_uncore_cpu_online, + amd_uncore_cpu_down_prepare); + if (ret) goto fail_start; + return 0; fail_start:
On Fri, Oct 13, 2023 at 09:30:46AM +0200, Ingo Molnar wrote: > Ugh, why on Earth didn't GCC warn about this? The bad pattern is pretty > simple & obvious once pointed out ... compilers should have no trouble > realizing that 'ret' is returned uninitialized in some of these control > paths. Yet not a peep from the compiler ... We disabled that warning years ago (5?) because GCC had too many false positives. regards, dan carpenter
* Sandipan Das <sandipan.das@amd.com> wrote: > On 10/13/2023 12:48 PM, Dan Carpenter wrote: > > Some of the error paths in this function return don't initialize the > > error code. Return -ENODEV. > > > > Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management") > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> > > --- > > arch/x86/events/amd/uncore.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c > > index 9b444ce24108..a389828f378c 100644 > > --- a/arch/x86/events/amd/uncore.c > > +++ b/arch/x86/events/amd/uncore.c > > @@ -1009,7 +1009,8 @@ static struct amd_uncore uncores[UNCORE_TYPE_MAX] = { > > static int __init amd_uncore_init(void) > > { > > struct amd_uncore *uncore; > > - int ret, i; > > + int ret = -ENODEV; > > + int i; > > > > if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && > > boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) > > > Thanks for catching this. I see that 'ret' remains uninitialized for cases > where the hotplug callback registration fails and was thinking if the > following is a better fix for this as the reason might not be ENODEV. Yeah, passing through the real error codes is usually better. Here's it's probably a bit academic, as I don't think we are even using the init return code in the init sequence iterator, see how the return code by do_one_initcall() gets ignored by do_initcall_level() & do_pre_smp_initcalls() ... Nevertheless, mind submitting this as a separate patch? Thanks, Ingo
* Dan Carpenter <dan.carpenter@linaro.org> wrote: > On Fri, Oct 13, 2023 at 09:30:46AM +0200, Ingo Molnar wrote: > > > Ugh, why on Earth didn't GCC warn about this? The bad pattern is pretty > > simple & obvious once pointed out ... compilers should have no trouble > > realizing that 'ret' is returned uninitialized in some of these control > > paths. Yet not a peep from the compiler ... > > We disabled that warning years ago (5?) because GCC had too many false > positives. GCC had some pretty bogus notions about 'possible' uninitialized use that encouraged some bad code patterns, but in this case there's readily provable uninitialized use, that a compiler should warn about. Is it possible to disable just the unreliable, probabilistic part of GCC's uninitialized variables warnings? Thanks, Ingo
On 10/13/2023 2:33 PM, Ingo Molnar wrote: > > * Sandipan Das <sandipan.das@amd.com> wrote: > >> On 10/13/2023 12:48 PM, Dan Carpenter wrote: >>> Some of the error paths in this function return don't initialize the >>> error code. Return -ENODEV. >>> >>> Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management") >>> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> >>> --- >>> arch/x86/events/amd/uncore.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c >>> index 9b444ce24108..a389828f378c 100644 >>> --- a/arch/x86/events/amd/uncore.c >>> +++ b/arch/x86/events/amd/uncore.c >>> @@ -1009,7 +1009,8 @@ static struct amd_uncore uncores[UNCORE_TYPE_MAX] = { >>> static int __init amd_uncore_init(void) >>> { >>> struct amd_uncore *uncore; >>> - int ret, i; >>> + int ret = -ENODEV; >>> + int i; >>> >>> if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && >>> boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) >> >> >> Thanks for catching this. I see that 'ret' remains uninitialized for cases >> where the hotplug callback registration fails and was thinking if the >> following is a better fix for this as the reason might not be ENODEV. > > Yeah, passing through the real error codes is usually better. > > Here's it's probably a bit academic, as I don't think we are even using the > init return code in the init sequence iterator, see how the return code by > do_one_initcall() gets ignored by do_initcall_level() & do_pre_smp_initcalls() ... > > Nevertheless, mind submitting this as a separate patch? > Sure. Will do.
On Fri, Oct 13, 2023 at 11:06 AM Ingo Molnar <mingo@kernel.org> wrote: > > > * Dan Carpenter <dan.carpenter@linaro.org> wrote: > > > On Fri, Oct 13, 2023 at 09:30:46AM +0200, Ingo Molnar wrote: > > > > > Ugh, why on Earth didn't GCC warn about this? The bad pattern is pretty > > > simple & obvious once pointed out ... compilers should have no trouble > > > realizing that 'ret' is returned uninitialized in some of these control > > > paths. Yet not a peep from the compiler ... > > > > We disabled that warning years ago (5?) because GCC had too many false > > positives. > > GCC had some pretty bogus notions about 'possible' uninitialized use that > encouraged some bad code patterns, but in this case there's readily > provable uninitialized use, that a compiler should warn about. > > Is it possible to disable just the unreliable, probabilistic part of GCC's > uninitialized variables warnings? -Wno-maybe-uninitialized? Uros.
* Uros Bizjak <ubizjak@gmail.com> wrote: > On Fri, Oct 13, 2023 at 11:06 AM Ingo Molnar <mingo@kernel.org> wrote: > > > > > > * Dan Carpenter <dan.carpenter@linaro.org> wrote: > > > > > On Fri, Oct 13, 2023 at 09:30:46AM +0200, Ingo Molnar wrote: > > > > > > > Ugh, why on Earth didn't GCC warn about this? The bad pattern is pretty > > > > simple & obvious once pointed out ... compilers should have no trouble > > > > realizing that 'ret' is returned uninitialized in some of these control > > > > paths. Yet not a peep from the compiler ... > > > > > > We disabled that warning years ago (5?) because GCC had too many false > > > positives. > > > > GCC had some pretty bogus notions about 'possible' uninitialized use that > > encouraged some bad code patterns, but in this case there's readily > > provable uninitialized use, that a compiler should warn about. > > > > Is it possible to disable just the unreliable, probabilistic part of GCC's > > uninitialized variables warnings? > > -Wno-maybe-uninitialized? No combination of the relevant compiler options appears to be able to get GCC to notice this bug. On top of tip:master, the patch below produces no compiler warnings with GCC 12.3.0: $ git revert 7543365739a4 $ rm -f arch/x86/events/amd/uncore.o $ make V=1 W=1e arch/x86/events/amd/uncore.o The "W=1e" incantation activates, with the patch below applied, among many other GCC options, the following options: -Wall -Wuninitialized -Wmaybe-uninitialized -Werror Which should have found this bug, right? [ The V=1 helps double checking the compiler options. ] Thanks, Ingo scripts/Makefile.extrawarn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 2fe6f2828d37..9d245fcff419 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -108,6 +108,8 @@ KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow) KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation) KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow) KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) +KBUILD_CFLAGS += $(call cc-option, -Wuninitialized) +KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) KBUILD_CPPFLAGS += -Wundef KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 @@ -176,7 +178,7 @@ KBUILD_CFLAGS += -Wno-shift-negative-value ifdef CONFIG_CC_IS_CLANG KBUILD_CFLAGS += -Wno-initializer-overrides else -KBUILD_CFLAGS += -Wno-maybe-uninitialized +#KBUILD_CFLAGS += -Wno-maybe-uninitialized endif endif
The surprising thing is the Clang doesn't detect the bug either. It's strange. (I found this bug with Smatch). Also I notice that my Fixes tag wasn't correct either. That patch did have a missing error code bug, but "ret" was set to zero. :/ regards, dan carpenter
* Dan Carpenter <dan.carpenter@linaro.org> wrote: > The surprising thing is the Clang doesn't detect the bug either. It's > strange. (I found this bug with Smatch). Yeah, that's weird and kind of concerning. I don't think either compiler is able to see that the init function return values are always ignored. I had to dig into init/main.c to convince myself. > Also I notice that my Fixes tag wasn't correct either. That patch did > have a missing error code bug, but "ret" was set to zero. :/ Yeah, so I left the Fixes tag out of the commit anyway, because this isn't really a fix that -stable should concern itself with. After the first commit it's not even a fix per se, but an improvement in the resolution & meaning of error codes or so. Thanks, Ingo
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 9b444ce24108..a389828f378c 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -1009,7 +1009,8 @@ static struct amd_uncore uncores[UNCORE_TYPE_MAX] = { static int __init amd_uncore_init(void) { struct amd_uncore *uncore; - int ret, i; + int ret = -ENODEV; + int i; if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)