diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-01-21 02:22:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-01-25 02:50:09 -0500 |
commit | 2993ae3305ad10b41e0d0bc2662f7754ee8e30fa (patch) | |
tree | a3ff55895017b1511896f6744e905311c1453f59 /arch/x86 | |
parent | fb53a1ab88d14848dc292842e35c3bda3a665997 (diff) |
x86/AMD/NB: Fix amd_set_subcaches() parameter type
This is under CAP_SYS_ADMIN, but Smatch complains that mask comes
from the user and the test for "mask > 0xf" can underflow.
The fix is simple: amd_set_subcaches() should hand down not an 'int'
but an 'unsigned long' like it was originally indended to do.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Daniel J Blueman <daniel@numascale-asia.com>
Link: http://lkml.kernel.org/r/20140121072209.GA22095@elgon.mountain
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/amd_nb.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/amd_nb.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index a54ee1d054d9..aaac3b2fb746 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -19,7 +19,7 @@ extern int amd_cache_northbridges(void); | |||
19 | extern void amd_flush_garts(void); | 19 | extern void amd_flush_garts(void); |
20 | extern int amd_numa_init(void); | 20 | extern int amd_numa_init(void); |
21 | extern int amd_get_subcaches(int); | 21 | extern int amd_get_subcaches(int); |
22 | extern int amd_set_subcaches(int, int); | 22 | extern int amd_set_subcaches(int, unsigned long); |
23 | 23 | ||
24 | struct amd_l3_cache { | 24 | struct amd_l3_cache { |
25 | unsigned indices; | 25 | unsigned indices; |
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 59554dca96ec..dec8de4e1663 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -179,7 +179,7 @@ int amd_get_subcaches(int cpu) | |||
179 | return (mask >> (4 * cuid)) & 0xf; | 179 | return (mask >> (4 * cuid)) & 0xf; |
180 | } | 180 | } |
181 | 181 | ||
182 | int amd_set_subcaches(int cpu, int mask) | 182 | int amd_set_subcaches(int cpu, unsigned long mask) |
183 | { | 183 | { |
184 | static unsigned int reset, ban; | 184 | static unsigned int reset, ban; |
185 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); | 185 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); |