]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Feb 2018 10:27:07 +0000 (11:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Feb 2018 10:27:07 +0000 (11:27 +0100)
added patches:
x86-cpu-change-type-of-x86_cache_size-variable-to-unsigned-int.patch

queue-4.4/series
queue-4.4/x86-cpu-change-type-of-x86_cache_size-variable-to-unsigned-int.patch [new file with mode: 0644]

index f6baf2ffe3551bf89b513c92b681cea8051e78e9..e1f5b68d8090be7568c086ee1005f7b90aa910f4 100644 (file)
@@ -7,3 +7,4 @@ arm-spear13xx-fix-dmas-cells.patch
 arm-spear13xx-fix-spics-gpio-controller-s-warning.patch
 alsa-seq-fix-regression-by-incorrect-ioctl_mutex-usages.patch
 kvm-x86-reduce-retpoline-performance-impact-in-slot_handle_level_range-by-always-inlining-iterator-helper-methods.patch
+x86-cpu-change-type-of-x86_cache_size-variable-to-unsigned-int.patch
diff --git a/queue-4.4/x86-cpu-change-type-of-x86_cache_size-variable-to-unsigned-int.patch b/queue-4.4/x86-cpu-change-type-of-x86_cache_size-variable-to-unsigned-int.patch
new file mode 100644 (file)
index 0000000..000abb7
--- /dev/null
@@ -0,0 +1,77 @@
+From 24dbc6000f4b9b0ef5a9daecb161f1907733765a Mon Sep 17 00:00:00 2001
+From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
+Date: Tue, 13 Feb 2018 13:22:08 -0600
+Subject: x86/cpu: Change type of x86_cache_size variable to unsigned int
+
+From: Gustavo A. R. Silva <garsilva@embeddedor.com>
+
+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 <tglx@linutronix.de>
+Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Addresses-Coverity-ID: 1464429
+Link: http://lkml.kernel.org/r/20180213192208.GA26414@embeddedor.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);