[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1462974711-10037-1-git-send-email-aryabinin@virtuozzo.com>
Date: Wed, 11 May 2016 16:51:51 +0300
From: Andrey Ryabinin <aryabinin@...tuozzo.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, <x86@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
CC: Jim Cromie <jim.cromie@...il.com>, Imre Palik <imrep@...zon.de>,
<linux-kernel@...r.kernel.org>,
Andrey Ryabinin <aryabinin@...tuozzo.com>
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.
Fixes: 2c33645d366d ("perf/x86: Honor the architectural performance monitoring version")
Reported-by: Jim Cromie <jim.cromie@...il.com>
Signed-off-by: Andrey Ryabinin <aryabinin@...tuozzo.com>
---
arch/x86/events/intel/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index a6fd4db..5210eaa 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -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);
}
}
--
2.7.3
Powered by blists - more mailing lists