Skip to contentSkip to conversation

FAILED: patch "[PATCH] perf/x86: Fix undefined shift on 32-bit kernels" failed to apply to 4.5-stable tree

PATCH [email protected] 1 participant 1 message May 14, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 6d6f2833bfbf296101f9f085e10488aef2601ba5 Mon Sep 17 00:00:00 2001

From: Andrey Ryabinin <[email protected]>
Date: Wed, 11 May 2016 16:51:51 +0300
Subject: [PATCH] perf/x86: Fix undefined shift on 32-bit kernels

Jim reported:

	UBSAN: Undefined behaviour in arch/x86/events/intel/core.c:3708:12
	shift exponent 35 is too large for 32-bit type 'long unsigned int'

The use of 'unsigned long' type obviously is not correct here, make it 'unsigned long long' instead.

Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Imre Palik <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vince Weaver <[email protected]>
Fixes 2c33645d366d ("perf/x86: Honor the architectural performance monitoring version")
arch/x86/events/intel/core.c +1 -1
index a6fd4dbcf820..5210eaa4aa62 100644
@@ -3708,7 +3708,7 @@ __init int intel_pmu_init(void)
 				c->idxmsk64 |= (1ULL << x86_pmu.num_counters) - 1;
 			}
 			c->idxmsk64 &=
-				~(~0UL << (INTEL_PMC_IDX_FIXED + x86_pmu.num_counters_fixed));
+				~(~0ULL << (INTEL_PMC_IDX_FIXED + x86_pmu.num_counters_fixed));
 			c->weight = hweight64(c->idxmsk64);
 		}
 	}