Commit 2993ae33 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ingo Molnar

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarBorislav 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.mountainSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent fb53a1ab
...@@ -19,7 +19,7 @@ extern int amd_cache_northbridges(void); ...@@ -19,7 +19,7 @@ extern int amd_cache_northbridges(void);
extern void amd_flush_garts(void); extern void amd_flush_garts(void);
extern int amd_numa_init(void); extern int amd_numa_init(void);
extern int amd_get_subcaches(int); extern int amd_get_subcaches(int);
extern int amd_set_subcaches(int, int); extern int amd_set_subcaches(int, unsigned long);
struct amd_l3_cache { struct amd_l3_cache {
unsigned indices; unsigned indices;
......
...@@ -179,7 +179,7 @@ int amd_get_subcaches(int cpu) ...@@ -179,7 +179,7 @@ int amd_get_subcaches(int cpu)
return (mask >> (4 * cuid)) & 0xf; return (mask >> (4 * cuid)) & 0xf;
} }
int amd_set_subcaches(int cpu, int mask) int amd_set_subcaches(int cpu, unsigned long mask)
{ {
static unsigned int reset, ban; static unsigned int reset, ban;
struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment