Received: by 10.223.185.116 with SMTP id b49csp409266wrg; Wed, 14 Feb 2018 00:39:08 -0800 (PST) X-Google-Smtp-Source: AH8x226BJs56ZniE9QGKgCuRwtKWd4yCmap62z+qfnxhBs//jns+HIfGg80yRhepYUwFWbgpHfKC X-Received: by 10.98.159.200 with SMTP id v69mr3991376pfk.236.1518597548694; Wed, 14 Feb 2018 00:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518597548; cv=none; d=google.com; s=arc-20160816; b=YQMKV4v+QW1IMMltsqrifgXpeCDEjEc09RcG0ukjqOi1d4DilClFv1KfOr3ChCOtV9 sCuu/kp4ujTad4qMLp0xZ4rNYb0ti6g24op3haOy1yWmUpgpOxRnlTEwMLE3jVxxmPB8 jNlq9UP6QQ0Wv2x4SPaxlVuSzD3psjdmcpEpYiHgW/wRv03565RagH2BaUdKhSSuT8UL eczRtixyEa0lIYgHg4bVawwXcIUeadG108S+ofPLSxX3PJjLQn+JlHO67zfCUzSD/KRA 8KcgupZnP6hZ/1aSAdUzXssu+VO2/RHz8qcfYHxmnVrgMGlTzxEmQV80R2UH60Qt1lDL 0nOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=kqocv51dfjaWbl+Nl4NPVuBmsO41JM1l49c6kyX9Ups=; b=BShhEHg+XMKBWAZTxfBJS7n6Dl1+/8IdHu8GHVdXAftB4znMSwKCNpdw/hcaTh1jyy /4j5Mz9HSQLz1Xn9GnC2euPhvK2sGadEMY3RnJi91BzWmQP8cU466kPbTtAB5LfIYgMX sYF2oL+7Mg8czglUI73Sl2PHcrT27VJPKtDcdzROtn5jenYAipepZ1zwgZxappVGm32j 5MYIJgjKRplUqbBLlPkx6zikJ+zOnIoHBQi8QWgUKOku38OANUGXKG/f+2Vq+mJHpiyC ekmo3508+RHA2t5BQf3rSqOMGQjiIFUH0a/aCgz7/kDnhx2yZpPCWmhLFaE5+5H5i8I4 iR9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g67si1280208pfk.314.2018.02.14.00.38.54; Wed, 14 Feb 2018 00:39:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754574AbeBNIiH (ORCPT + 99 others); Wed, 14 Feb 2018 03:38:07 -0500 Received: from terminus.zytor.com ([198.137.202.136]:54293 "EHLO terminus.zytor.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751427AbeBNIiF (ORCPT ); Wed, 14 Feb 2018 03:38:05 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1E8bPIe022228; Wed, 14 Feb 2018 00:37:25 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1E8bOMU022225; Wed, 14 Feb 2018 00:37:24 -0800 Date: Wed, 14 Feb 2018 00:37:24 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: "tip-bot for Gustavo A. R. Silva" Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, garsilva@embeddedor.com, linux-kernel@vger.kernel.org, bp@alien8.de, torvalds@linux-foundation.org, mingo@kernel.org, peterz@infradead.org Reply-To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, bp@alien8.de, garsilva@embeddedor.com, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org In-Reply-To: <20180213192208.GA26414@embeddedor.com> References: <20180213192208.GA26414@embeddedor.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/cpu: Change type of x86_cache_size variable to unsigned int Git-Commit-ID: 0bfa9f1c5d3d290461f554520b8f24316ec971e0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0bfa9f1c5d3d290461f554520b8f24316ec971e0 Gitweb: https://git.kernel.org/tip/0bfa9f1c5d3d290461f554520b8f24316ec971e0 Author: Gustavo A. R. Silva AuthorDate: Tue, 13 Feb 2018 13:22:08 -0600 Committer: Ingo Molnar CommitDate: Wed, 14 Feb 2018 09:14:44 +0100 x86/cpu: Change type of x86_cache_size variable to unsigned int Currently, x86_cache_size is of type int, which makes no sense as we will never have a valid cache size equal or less than 0. So instead of initializing this variable to -1, it can perfectly be initialized to 0 and use it as an unsigned variable instead. Suggested-by: Thomas Gleixner Signed-off-by: Gustavo A. R. Silva Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Addresses-Coverity-ID: 1464429 Link: http://lkml.kernel.org/r/20180213192208.GA26414@embeddedor.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/processor.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/cpu/microcode/intel.c | 2 +- arch/x86/kernel/cpu/proc.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index b7c8583..44c2c4e 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -109,7 +109,7 @@ struct cpuinfo_x86 { char x86_vendor_id[16]; char x86_model_id[64]; /* in KB - valid for CPUS which support this call: */ - int x86_cache_size; + unsigned int x86_cache_size; int x86_cache_alignment; /* In bytes */ /* Cache QoS architectural values: */ int x86_cache_max_rmid; /* max index */ diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index a7d8df6..824aee0 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1184,7 +1184,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) int i; c->loops_per_jiffy = loops_per_jiffy; - c->x86_cache_size = -1; + c->x86_cache_size = 0; c->x86_vendor = X86_VENDOR_UNKNOWN; c->x86_model = c->x86_stepping = 0; /* So far unknown... */ c->x86_vendor_id[0] = '\0'; /* Unset */ diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index b94279b..a15db2b 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -982,7 +982,7 @@ static struct microcode_ops microcode_intel_ops = { static int __init calc_llc_size_per_core(struct cpuinfo_x86 *c) { - u64 llc_size = c->x86_cache_size * 1024; + u64 llc_size = c->x86_cache_size * 1024ULL; do_div(llc_size, c->x86_max_cores); diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index ee4cc38..2c8522a 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c @@ -91,8 +91,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) } /* Cache size */ - if (c->x86_cache_size >= 0) - seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size); + if (c->x86_cache_size) + seq_printf(m, "cache size\t: %u KB\n", c->x86_cache_size); show_cpuinfo_core(m, c, cpu); show_cpuinfo_misc(m, c);