From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753057AbcELKhS (ORCPT ); Thu, 12 May 2016 06:37:18 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38712 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751940AbcELKhP (ORCPT ); Thu, 12 May 2016 06:37:15 -0400 Date: Thu, 12 May 2016 03:34:14 -0700 From: tip-bot for Andrey Ryabinin Message-ID: Cc: acme@redhat.com, torvalds@linux-foundation.org, aryabinin@virtuozzo.com, eranian@google.com, vincent.weaver@maine.edu, peterz@infradead.org, tglx@linutronix.de, stable@vger.kernel.org, jolsa@redhat.com, imrep@amazon.de, hpa@zytor.com, alexander.shishkin@linux.intel.com, jim.cromie@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: torvalds@linux-foundation.org, acme@redhat.com, eranian@google.com, aryabinin@virtuozzo.com, vincent.weaver@maine.edu, peterz@infradead.org, stable@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com, imrep@amazon.de, jolsa@redhat.com, jim.cromie@gmail.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1462974711-10037-1-git-send-email-aryabinin@virtuozzo.com> References: <1462974711-10037-1-git-send-email-aryabinin@virtuozzo.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86: Fix undefined shift on 32-bit kernels Git-Commit-ID: 6d6f2833bfbf296101f9f085e10488aef2601ba5 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6d6f2833bfbf296101f9f085e10488aef2601ba5 Gitweb: http://git.kernel.org/tip/6d6f2833bfbf296101f9f085e10488aef2601ba5 Author: Andrey Ryabinin AuthorDate: Wed, 11 May 2016 16:51:51 +0300 Committer: Ingo Molnar CommitDate: Thu, 12 May 2016 10:14:31 +0200 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. Reported-by: Jim Cromie Signed-off-by: Andrey Ryabinin Signed-off-by: Peter Zijlstra (Intel) Cc: Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: H. Peter Anvin Cc: Imre Palik Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Fixes: 2c33645d366d ("perf/x86: Honor the architectural performance monitoring version") Link: http://lkml.kernel.org/r/1462974711-10037-1-git-send-email-aryabinin@virtuozzo.com Signed-off-by: Ingo Molnar --- 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); } }