Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2565359lkm; Mon, 20 Sep 2021 18:51:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4DeJn2XRz1gfJ7KRoZvCPSiv5tsuGPlYa+fiKVnZ/vR1xdhidyUoxju9CjCyoAqxXwJqU X-Received: by 2002:a6b:4f04:: with SMTP id d4mr9252361iob.95.1632188973315; Mon, 20 Sep 2021 18:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188973; cv=none; d=google.com; s=arc-20160816; b=mFeOyIDVm/yJc4+9b0EKEHhjsxwGLtSBmP6QIGWA7RTX9k/EPK1qzFMqS1fjaMMTEj yfJhZUfotkeSKPpqqODiZUXpCrI7wbDYuhMA7PfP1XDgYIrcC4sJoK1xkD8Nx83SSNjq WmeQswN1BGF+C9fjbsxRg8Cjq83D4Dp0pDevmluwmUbrbrckE0alEf0HWIPwTmoEigt4 ZDJ41QMFUayd1YTtgnio+b8djLBZTLiVI1HCCiNLveYxzl2jr/x91iJX4qiXYmwNhlLo J02uKGGjClZyAzRoRLvDuMvL4qZBW00Wl2a43BNpwiuP7jbcWEESFW8kOmEaCbFGMpqd +nFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=16nibchQPf66KfSHkDvvTvmQ5rmv0TLy6K0P0x7/VWw=; b=FpL13dzLGUQptqJ4fLgN9QJh0VRGjwPVjdQ5iYHTSiHhfJ8zuc6TJeBeX2s6SI65oa 95jCkSQaRddt6rflS5DgO78agtV/qN+3easPaKfgqcyMyXqxulsYsmzqgzhJu9m4owuV yGRcwKlVOfd2RaMmfy9nUDfihCifqSLAnDT+rvbBgIS0xrhJLuG7A/3h7+d1Rp15B3cA Tblh78f0nnLwTeqZn0/otnVuiGBPKBIY6SrMLTqo6m8uSlHNPVRrUfKWUkeHHpfo0yI3 VE1ewKVXMGkXrlAK/PmndSAb1zA8qXv21tt1f4SDrS4mq3LEDW8rJZIAQ+N0qd1w+i6G Ap3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CL/KpwC7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si2553036ioz.73.2021.09.20.18.49.22; Mon, 20 Sep 2021 18:49:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CL/KpwC7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349287AbhITRqB (ORCPT + 99 others); Mon, 20 Sep 2021 13:46:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348596AbhITRoE (ORCPT ); Mon, 20 Sep 2021 13:44:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B56EA61B80; Mon, 20 Sep 2021 17:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157770; bh=uPXrmDh7kZSvKIn0RbuwYZeVyuqUtokgGqN/KQMWdVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CL/KpwC7+/3AX2XAYfeTiyg8ehSOELQxmsCRZGgLzUswZduKn8SEq0COkA0CZmX62 Gok9qyguZVTeHpxBNeQPQkWdlfU66tBDOprC0bIQlrD2kkXFZEMyX6naQGXB9Y7CED GUslEsJOCQ3Kj3NVehP/VP95i+VAOe59WhRJqY/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Terry Bowman , kernel test robot , Babu Moger , Borislav Petkov , Reinette Chatre Subject: [PATCH 4.19 111/293] x86/resctrl: Fix a maybe-uninitialized build warning treated as error Date: Mon, 20 Sep 2021 18:41:13 +0200 Message-Id: <20210920163937.061762377@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Babu Moger commit 527f721478bce3f49b513a733bacd19d6f34b08c upstream. 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 Reported-by: kernel test robot Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov Reviewed-by: Reinette Chatre Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/162949631908.23903.17090272726012848523.stgit@bmoger-ubuntu Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/intel_rdt_monitor.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/x86/kernel/cpu/intel_rdt_monitor.c +++ b/arch/x86/kernel/cpu/intel_rdt_monitor.c @@ -252,6 +252,12 @@ static u64 __mon_event_count(u32 rmid, s 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) {