mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Babu Moger" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Terry Bowman <Terry.Bowman@amd.com>,
	kernel test robot <lkp@intel.com>,
	Babu Moger <babu.moger@amd.com>, Borislav Petkov <bp@suse.de>,
	Reinette Chatre <reinette.chatre@intel.com>,
	stable@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] x86/resctrl: Fix a maybe-uninitialized build warning treated as error
Date: Sun, 22 Aug 2021 07:25:50 -0000	[thread overview]
Message-ID: <162961715100.25758.14486039318102865041.tip-bot2@tip-bot2> (raw)
In-Reply-To: <162949631908.23903.17090272726012848523.stgit@bmoger-ubuntu>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     527f721478bce3f49b513a733bacd19d6f34b08c
Gitweb:        https://git.kernel.org/tip/527f721478bce3f49b513a733bacd19d6f34b08c
Author:        Babu Moger <babu.moger@amd.com>
AuthorDate:    Fri, 20 Aug 2021 16:52:42 -05:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Sun, 22 Aug 2021 09:11:29 +02:00

x86/resctrl: Fix a maybe-uninitialized build warning treated as error

The recent commit

  064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")

caused a RHEL build failure with an uninitialized variable warning
treated as an error because it removed the default case snippet.

The RHEL Makefile uses '-Werror=maybe-uninitialized' to force possibly
uninitialized variable warnings to be treated as errors. This is also
reported by smatch via the 0day robot.

The error from the RHEL build is:

  arch/x86/kernel/cpu/resctrl/monitor.c: In function ‘__mon_event_count’:
  arch/x86/kernel/cpu/resctrl/monitor.c:261:12: error: ‘m’ may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
    m->chunks += chunks;
              ^~

The upstream Makefile does not build using '-Werror=maybe-uninitialized'.
So, the problem is not seen there. Fix the problem by putting back the
default case snippet.

 [ bp: note that there's nothing wrong with the code and other compilers
   do not trigger this warning - this is being done just so the RHEL compiler
   is happy. ]

Fixes: 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
Reported-by: Terry Bowman <Terry.Bowman@amd.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/162949631908.23903.17090272726012848523.stgit@bmoger-ubuntu
---
 arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index 57e4bb6..8caf871 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read *rr)
 	case QOS_L3_MBM_LOCAL_EVENT_ID:
 		m = &rr->d->mbm_local[rmid];
 		break;
+	default:
+		/*
+		 * Code would never reach here because an invalid
+		 * event id would fail the __rmid_read.
+		 */
+		return RMID_VAL_ERROR;
 	}
 
 	if (rr->first) {

      reply	other threads:[~2021-08-22  7:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 21:52 [PATCH v2] x86/resctrl: Fix 'uninitialized symbol' build warning Babu Moger
2021-08-22  7:25 ` tip-bot2 for Babu Moger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=162961715100.25758.14486039318102865041.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=Terry.Bowman@amd.com \
    --cc=babu.moger@amd.com \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=reinette.chatre@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®