Received: by 10.223.185.116 with SMTP id b49csp684507wrg; Wed, 21 Feb 2018 05:21:52 -0800 (PST) X-Google-Smtp-Source: AH8x225s5xHTVoOKaCYSypb1as+y7V3l4DwsHoSLG9Fwa20uJgQ48yV2S7ROykmjg2SP1ADIwGOd X-Received: by 10.99.129.66 with SMTP id t63mr2669666pgd.376.1519219312364; Wed, 21 Feb 2018 05:21:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519219312; cv=none; d=google.com; s=arc-20160816; b=pGCUFXDyOdZUrfZOkjgVoiFA/tghsEQYnPSzl/qAGqYVHT4qLo6vlHuP7HXsrf89V5 PgOFZC7ITBzSkmBgOSmZqohHvmkHkQ65Px8DjFvkRxlqutbifRlAvVo/F22Xh8JNCUzt kMhojnp3O7HuTHbLo7q3Cbqxbx679qJWpBVUsLXz0kphOh3V99K7bi3tmIH5P8ogu4LO kAThL1ECTcl97IosxKiwtFaePwaNk6734tCws6ZVRFkOWUQmEy877lzDDoIOmTW3cMXB jYTQP1fkMvPIstyl/y1CTlFN6bI3pFF7NBqBEHWRmjL4sTwNpFbdE3fyEOeU+xoKZ5mT qiJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ApHNRAh4rTAWLpKrsXNkpof8KoC8AcK/bKK1OssxByQ=; b=Q2RBz9CI2t1M6iV6KducDTItmpHYVzayw/ZTIBSxqEVBSsMVugOm8WnTU5HiOn5J1k qaMXZagImrFxUrj3V8xojYceW1DIx0bKT0qKZ+u2j+ABttvd82+DdADo24uArhGmegYm +/4ScveK+FnCHrDFbfwfn2f9ifEXbLF5NBZdvYqcgKnID7XJQMVoN5IwNQxGwCT7MCk6 90bESsThlpIvfbiSh7bhvubmGWctBsWYE8smVOX/I6oFRoliQN18kASPe1ieo7Z4EIS9 BetNfDhEZu7Up9SZBpn/5OBmLxng8bsjJYre7PBpjADewg00Tgaun/fAh2x8N0IQfyg1 qT6w== 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 m189si2619604pfc.410.2018.02.21.05.21.38; Wed, 21 Feb 2018 05:21:52 -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 S933900AbeBUMqX (ORCPT + 99 others); Wed, 21 Feb 2018 07:46:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59474 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbeBUMqU (ORCPT ); Wed, 21 Feb 2018 07:46:20 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7BFD78A6; Wed, 21 Feb 2018 12:46:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , "Gustavo A. R. Silva" , Borislav Petkov , Linus Torvalds , Peter Zijlstra , Ingo Molnar Subject: [PATCH 4.4 10/33] x86/cpu: Change type of x86_cache_size variable to unsigned int Date: Wed, 21 Feb 2018 13:44:53 +0100 Message-Id: <20180221124410.226816399@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124409.564661689@linuxfoundation.org> References: <20180221124409.564661689@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gustavo A. R. Silva commit 24dbc6000f4b9b0ef5a9daecb161f1907733765a upstream. 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 Signed-off-by: Greg Kroah-Hartman --- 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(-) --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -113,7 +113,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 */ --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -955,7 +955,7 @@ static void identify_cpu(struct cpuinfo_ 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_mask = 0; /* So far unknown... */ c->x86_vendor_id[0] = '\0'; /* Unset */ --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -1075,7 +1075,7 @@ static struct microcode_ops microcode_in 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); --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c @@ -87,8 +87,8 @@ static int show_cpuinfo(struct seq_file } /* 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);