lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <162947718839.12313.2592762168334394449.stgit@bmoger-ubuntu>
Date:   Fri, 20 Aug 2021 11:33:08 -0500
From:   Babu Moger <babu.moger@....com>
To:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de
Cc:     fenghua.yu@...el.com, Terry.Bowman@....com, x86@...nel.org,
        linux-kernel@...r.kernel.org, hpa@...or.com,
        reinette.chatre@...el.com
Subject: [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning

The recent commit 064855a69003 ("x86/resctrl: Fix default monitoring
groups reporting"), caused a RHEL8.5 build failure with an uninitialized
variable warning treated as an error. The commit removed the default case
snippet. The RHEL8.5 Makefile uses '-Werror=maybe-uninitialized' to force
uninitialized variable warnings to be treated as errors. This is also
reported by kernel test robot. The error from the RHEL8.5 build is below:

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.

Fixes: 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
Cc: stable@...r.kernel.org
Reported-by: Terry Bowman <Terry.Bowman@....com>
Reported-by: kernel test robot <lkp@...el.com>
Link: https://lore.kernel.org/lkml/6118d218.4ZZRXYKZCzQSq1Km%25lkp@intel.com/

Signed-off-by: Babu Moger <babu.moger@....com>
---
 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 57e4bb695ff9..8caf871b796f 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) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ