x86/oprofile: fix wrapping bug in op_x86_get_ctrl()
Subsystems (2)
PATCH 1/1 x86/oprofile: fix wrapping bug in op_x86_get_ctrl()
The "event" variable is a u16 so the shift will always wrap to zero making the line a no-op.
---
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.
arch/x86/oprofile/nmi_int.c +1 -1
@@ -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; }
Quoted 4 lines · Dan Carpenter
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 <[email protected]>
Patch applied. Thanks for reporting and fixing.
-Robert
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
[GIT PULL] oprofile fixes
Ingo,
Quoted 7 lines · Robert Richter
Quoted 4 lines · Dan Carpenter
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 <[email protected]>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(-)
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
Re: [GIT PULL] oprofile fixes
Quoted 7 lines · Robert Richter
Ingo,
Quoted 4 lines · Robert Richter
Quoted 3 lines · Dan Carpenter
The "event" variable is a u16 so the shift will always wrap to zero making the line a no-op.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>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.giturgent
Pulled, thanks guys!
Ingo