kernel-janitors.vger.kernel.org archive mirror
 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; 2+ 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] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2012-10-15 14:39 UTC | newest]

Thread overview: 2+ 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

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).