Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp35824pxb; Mon, 13 Sep 2021 12:14:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV1VBRyri9cnDvAABiQ2oO2iCxcL7Cj7qn6Lr848DW4fDYyzxfkT3gIyBiUg5Fn7G81LNX X-Received: by 2002:a92:b301:: with SMTP id p1mr8857955ilh.10.1631560443815; Mon, 13 Sep 2021 12:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631560443; cv=none; d=google.com; s=arc-20160816; b=z49hGD9ygAALMRe3ky3aQTJk7EUyAUTtgnpoHQCgz/NMd85KYWGYWhbslKW3D3qXrl Ty5TNGGnP5lpFSKnsNUQtHUYaixF+2n2Jm4ib/YjpgBldOdHHSwsJyQr0kuIUcPjqR7A 4mr3w2jSJbPh+W1kJDNjq0rvgNddX1dOVZxXSqZ1/lmxCxK+TtADsjb051M0sJLvd7NM YU2xj2dG/9xESXKbxf9ZMxH3eRQCKRFMoLNmnccbvLKa0pd33PuqAdR9Tv8byw90WNTd faqRyqKzQQ8pqQMNlQcpf5Uu5z4rul8Omm00KGV0M+5f6lXZ9KPmwlTApotKI3YhJASq itKQ== 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=dwt1Pafvo8iHDAJMjejvxomxD9/krlFsAak0PMKUkJo=; b=Hj3v6N0SlxFY+bIe6MFsl+JL3QMPOgd+S3CP3NZ3oktTr/CwqN6U8r4OFn38OWw7cx muxc2p93nqGbiKCpRVR6Sn5CFpJ0kKSWeQ74JciKR60Ncjlo60YVPPUfkNLcOC2kr7eU azZeoDDppWRtFfj2MPkYr6rCi9TOVR2Y/Mbv3k1bvwk8a60nBcOuoLcylnxrmcnANpMi 80L6AHLpEfF7aORH1rwAKDfRgM6mdL7CEVPX1ud4tswuqukgHiHZ2tXl+mfiakotl9s4 HhPTnZrqTipZYbCZjCapHpvIR32OYLMAvH80xVj3f9XUdcCjWqGGSqBDRzaJDjUU2neS s5xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nvC46eAJ; 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 h33si8725317jav.17.2021.09.13.12.13.52; Mon, 13 Sep 2021 12:14:03 -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=nvC46eAJ; 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 S241415AbhIMNcu (ORCPT + 99 others); Mon, 13 Sep 2021 09:32:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:46794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242158AbhIMN1m (ORCPT ); Mon, 13 Sep 2021 09:27:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5632B610A3; Mon, 13 Sep 2021 13:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539387; bh=sQsT2xjt5o3JvCbwXYvr6OWVauUhVa/ErGSIHWQDgvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nvC46eAJsYKcEUuLpbwB265TOSnlO8YweMBvlBtSfeY/xWo0lfCnlAZfgk4iPtd6u IRprV+/CIwEGnESQzN7JqW35u/PVg8biUAbrYhOO89lijDHRXoUJAEro6wuC3pgzWD GORMcTf4HGhEI/zmmPn8yqKY8Hc200T1hyKkH01E= 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.4 134/144] x86/resctrl: Fix a maybe-uninitialized build warning treated as error Date: Mon, 13 Sep 2021 15:15:15 +0200 Message-Id: <20210913131052.417258062@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@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 @@ -242,6 +242,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) {