Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1877146pxb; Mon, 13 Sep 2021 07:23:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfzAuVN1QQXOHZyIVjV1c+8qT+/pRfIG6fveC0qPp9wHJD3oEml/u3Plni1PCSuXpErF/H X-Received: by 2002:a6b:e712:: with SMTP id b18mr9489739ioh.186.1631542875858; Mon, 13 Sep 2021 07:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631542875; cv=none; d=google.com; s=arc-20160816; b=acGjk1nd897dB7z8d3p+8LdS4eLOC6ke+cZwpY4TtMx5Iyb0OjVKi0wqqDlbx3COUL 5ffddJ+HJ3IO1NDwlQWT+U1QHNhlt7iI6AJcd6ILR/qUmtc7CUPisqxuWZMk2hkyDJN7 J9R93sEjnPx+RQzaJUo3lvvSTz4R2gHt0EmlHBzea/jUiU1NscDXADLXa3MIlUxv/C98 uCS6dvcSTWOXveqQbI1NPTUBquX2x7cicfIJszJ6k9kGNCkqDSpo2bbBgd/a5tbKAAyq pHwg2hxx59aj+P9hGqJuAXkEosZu/9Sx3NgXOj8CWiNNTP2mR6GyMdze5kx/0hbCikQS snJQ== 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=04AXQFRKd+oCBSqBMpQNgAhfeGBuuWQZIl9iTDogGfo=; b=ARGK64XM+XvGXUtidxW1MSB1aCDtBCqUK3EO1N4E9EcNsvlTUbjYHJSBjbCdoMUCx9 ArbZjK0HMMUahbFLMTOQyY/fb/+2/PV5LNfbSN0vJSlpkgDlenGJf16vLHpvOKyr9SE+ 73/U08xR/I4OdswvUBJ+lk+IiVE7tFeqgSApfm5GnOYZ1jqjmTPEXcJpfw8BcN4LGSID mHH9CAKdiLmfY8lrgfTu7Igg9VcxNRy29gwXzKm7FDCdvWjj0TAbNUBeLahnebXrXAbE iGWDFvKvpQTe9Wlxn4mCzWAChUaOYAUB/UmzG3LvJIti+li/8xKraEyRfQptDetDpY4i YbTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EPHqCI3Z; 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 p31si8481821jac.95.2021.09.13.07.21.02; Mon, 13 Sep 2021 07:21:15 -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=EPHqCI3Z; 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 S1345512AbhIMOTt (ORCPT + 99 others); Mon, 13 Sep 2021 10:19:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:37086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242081AbhIMOPM (ORCPT ); Mon, 13 Sep 2021 10:15:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E9CB61AF7; Mon, 13 Sep 2021 13:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540647; bh=7EsTNrhMloFM0bqOLE3itASJWsogX4jXXnrrw9+HEms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPHqCI3ZblGBlVQ5f5ONNJFSNKkLyeYavLd2RcjaDSwmN9HNlSXuI5XjF3NZ5YyWP jO2dU8PnFH1lslJQNg3By7udeDyINWlSDi7tTBYF9CjfF9LigozgLtsDNjMh9UpXRo TqP+KbVzAfchYjQjFclum+b7e7EIrZDFa4d7G7bg= 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.13 279/300] x86/resctrl: Fix a maybe-uninitialized build warning treated as error Date: Mon, 13 Sep 2021 15:15:40 +0200 Message-Id: <20210913131118.770208001@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131109.253835823@linuxfoundation.org> References: <20210913131109.253835823@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 @@ -304,6 +304,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) {