Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp104137pxb; Mon, 13 Sep 2021 14:12:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlkm2eSDcFwJHYMSh/IsHiMN4K1VaVytXNr4bzH2plf9mg8sYTu82FhPsB2cHjPxU88ZFY X-Received: by 2002:a05:6402:3c2:: with SMTP id t2mr6661898edw.261.1631567521751; Mon, 13 Sep 2021 14:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631567521; cv=none; d=google.com; s=arc-20160816; b=aHrN1LXt8WqALQMFW41uhAPi6YVaJri/QlZHn/pJdhimqkTkSJ7hT5MWOS4I//SJSs PaOvKwVhLy8MZuiaMirwPOylw4MmhbOjEksE1OETYTOL6F/XU3P3ebkwnJ6KrfkPjYzA Tb3BEnZiTGJSBdZpjhoBHd9VQV63XpGi+D2aX32lik+YqhXUjUC0qOZxwhgf9LlDedyY jejGmOEMUZ2ocyyuWS7wnbRlit+DKf6aE7iY5vh/oxyJPHzz+RH8S1or+iC7ieu9wIg7 ExzhVbQ8v6UNZieAvtnxGOXkOLUwuuVJJkHXXG+WPyJDaN7+2dMo0OBNmjgalYqWsSti kh/g== 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=epu2MvLuZFSZk8u1CbWkrcRLGx6Nzu3DD0XzTsmeU/g=; b=GHHroLFaK79WFCnxLyxaMznQKjxZg7y7Rw2A6ipsdZ8JCj+WemmDFA2CLnLUPIow7O +oLLohy8S7xu/LBKVqPoRQwUHpmhs5xCobNG5n/E918vgpDVI6nuc1awDVO44LmId8WO pmWLFYZy08dkqLUY+BB/IP54XhNGR4f3SXhsu3We4s9Hji//oCDFpAT+9IohzUc+m0fZ pj9x2lVbDNd8+c7xcdHTKVdZYTmDAFD/3KACKcCaxXdtCbHeYlJe5lIgYu7YYd5kE9V1 bvYW3q1vaXgo3Jzw341HWp80i/r8d188TZkYpgLe07l+5NRhk9U4ucDZfHoNbVddrlgB 6e4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T0UlJdBE; 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 r21si578934ejo.47.2021.09.13.14.11.37; Mon, 13 Sep 2021 14:12:01 -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=T0UlJdBE; 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 S243276AbhIMNvu (ORCPT + 99 others); Mon, 13 Sep 2021 09:51:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:56762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243272AbhIMNrd (ORCPT ); Mon, 13 Sep 2021 09:47:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB70D61355; Mon, 13 Sep 2021 13:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539943; bh=ash2koyFeiiGy4hqAHEQZZGvnpjIglcygzj4y4yZKwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0UlJdBEroL1WBgI7Lc3IlPXc3b/qQfMjk1qnF6MdFAnM4u4CJn208gGVRRyowuzE N1PczxvY1kGlN32MEGIvuCVwtJyBTNkw0ygGJzj0yNBV0UBFC1vXFOByI/OP6sQpHV 4i37oikIE2K0Lf6Q001E0se65v/YAWUZJN31gZl8= 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 5.10 223/236] x86/resctrl: Fix a maybe-uninitialized build warning treated as error Date: Mon, 13 Sep 2021 15:15:28 +0200 Message-Id: <20210913131107.943271302@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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/resctrl/monitor.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -241,6 +241,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) {