linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Andrey Ryabinin <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:perf/core] perf/x86: Fix undefined shift on 32-bit kernels
Date: Thu, 12 May 2016 03:34:14 -0700	[thread overview]
Message-ID: <tip-6d6f2833bfbf296101f9f085e10488aef2601ba5@git.kernel.org> (raw)
In-Reply-To: <1462974711-10037-1-git-send-email-aryabinin@virtuozzo.com>

Commit-ID:  6d6f2833bfbf296101f9f085e10488aef2601ba5
Gitweb:     http://git.kernel.org/tip/6d6f2833bfbf296101f9f085e10488aef2601ba5
Author:     Andrey Ryabinin <aryabinin@virtuozzo.com>
AuthorDate: Wed, 11 May 2016 16:51:51 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
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 <jim.cromie@gmail.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@vger.kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Imre Palik <imrep@amazon.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
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 <mingo@kernel.org>
---
 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);
 		}
 	}

      parent reply	other threads:[~2016-05-12 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 18:56 rcX probs, UBSAN complaints. one complaint about BIOS Jim Cromie
2016-05-11 13:51 ` [PATCH] perf/x86: fix undefined shift on 32-bit kernels Andrey Ryabinin
2016-05-11 14:08   ` Peter Zijlstra
2016-05-12 10:34   ` tip-bot for Andrey Ryabinin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-6d6f2833bfbf296101f9f085e10488aef2601ba5@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=imrep@amazon.de \
    --cc=jim.cromie@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.weaver@maine.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).