All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] x86/oprofile: fix wrapping bug in op_x86_get_ctrl()
@ 2012-10-10  7:18 Dan Carpenter
  2012-10-15 14:39 ` Robert Richter
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-10-10  7:18 UTC (permalink / raw)
  To: kernel-janitors

The "event" variable is a u16 so the shift will always wrap to zero
making the line a no-op.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This was introduced in 2009 in 3370d35856 "x86/oprofile: replace macros
to calculate control register".  I am doing static analysis and I'm not
very familiar with this code.  Please review my changes carefully.

diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 26b8a85..48768df 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -55,7 +55,7 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
 	val |= counter_config->extra;
 	event &= model->event_mask ? model->event_mask : 0xFF;
 	val |= event & 0xFF;
-	val |= (event & 0x0F00) << 24;
+	val |= (u64)(event & 0x0F00) << 24;
 
 	return val;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] x86/oprofile: fix wrapping bug in op_x86_get_ctrl()
  2012-10-10  7:18 [patch] x86/oprofile: fix wrapping bug in op_x86_get_ctrl() Dan Carpenter
@ 2012-10-15 14:39 ` Robert Richter
  2012-10-15 14:47   ` [GIT PULL] oprofile fixes Robert Richter
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Richter @ 2012-10-15 14:39 UTC (permalink / raw)
  To: kernel-janitors

On 10.10.12 10:18:35, Dan Carpenter wrote:
> The "event" variable is a u16 so the shift will always wrap to zero
> making the line a no-op.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied. Thanks for reporting and fixing.

-Robert

-- 
Advanced Micro Devices, Inc.
Operating System Research Center


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [GIT PULL] oprofile fixes
  2012-10-15 14:39 ` Robert Richter
@ 2012-10-15 14:47   ` Robert Richter
  2012-10-21 16:12     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Richter @ 2012-10-15 14:47 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Dan Carpenter, oprofile-list, linux-kernel

Ingo,

On 15.10.12 16:39:12, Robert Richter wrote:
> On 10.10.12 10:18:35, Dan Carpenter wrote:
> > The "event" variable is a u16 so the shift will always wrap to zero
> > making the line a no-op.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Patch applied. Thanks for reporting and fixing.

please pull this fix for tip:perf/urgent from

 git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git urgent

Thanks,

-Robert



The following changes since commit ddffeb8c4d0331609ef2581d84de4d763607bd37:

  Linux 3.7-rc1 (2012-10-14 14:41:04 -0700)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git urgent

Dan Carpenter (1):
      oprofile, x86: Fix wrapping bug in op_x86_get_ctrl()

 arch/x86/oprofile/nmi_int.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


-- 
Advanced Micro Devices, Inc.
Operating System Research Center


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] oprofile fixes
  2012-10-15 14:47   ` [GIT PULL] oprofile fixes Robert Richter
@ 2012-10-21 16:12     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2012-10-21 16:12 UTC (permalink / raw)
  To: Robert Richter; +Cc: Dan Carpenter, oprofile-list, linux-kernel


* Robert Richter <robert.richter@amd.com> wrote:

> Ingo,
> 
> On 15.10.12 16:39:12, Robert Richter wrote:
> > On 10.10.12 10:18:35, Dan Carpenter wrote:
> > > The "event" variable is a u16 so the shift will always wrap to zero
> > > making the line a no-op.
> > > 
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Patch applied. Thanks for reporting and fixing.
> 
> please pull this fix for tip:perf/urgent from
> 
>  git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git urgent

Pulled, thanks guys!

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-21 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10  7:18 [patch] x86/oprofile: fix wrapping bug in op_x86_get_ctrl() Dan Carpenter
2012-10-15 14:39 ` Robert Richter
2012-10-15 14:47   ` [GIT PULL] oprofile fixes Robert Richter
2012-10-21 16:12     ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.