Skip to contentSkip to conversation

mm/mpol: Make MPOL_LOCAL a real policy

DISCUSSION Dan Carpenter 1 participant 2 messages May 21, 2012 – Sep 27, 2012 Memory management

lore
Share & tools
lore
#0 lore raw

Hello Peter Zijlstra,

The patch 03ed7b538ca0: "mm/mpol: Make MPOL_LOCAL a real policy" from Mar 19, 2012, leads to the following warning:
mm/mempolicy.c:2591 mpol_parse_str()
error: buffer overflow 'policy_modes' 5 <= 5

mm/mempolicy.c
2590 for (mode = 0; mode < MPOL_MAX; mode++) {
2591 if (!strcmp(str, policy_modes[mode])) {
2592 break;
2593 }
2594 }

The problem is that MPOL_NOOP is not defined in policy_modes[] so we search past the end of the array.

regards,
dan carpenter

#1 lore raw

Whatever happened with this? It's a small read past the end of the
array, but probably it should be fixed.

regards,
dan carpenter

Quoted 14 lines · Dan Carpenter

Hello Peter Zijlstra,

The patch 03ed7b538ca0: "mm/mpol: Make MPOL_LOCAL a real policy" from Mar 19, 2012, leads to the following warning:
mm/mempolicy.c:2591 mpol_parse_str()
error: buffer overflow 'policy_modes' 5 <= 5

mm/mempolicy.c
2590 for (mode = 0; mode < MPOL_MAX; mode++) {
2591 if (!strcmp(str, policy_modes[mode])) {
2592 break;
2593 }
2594 }

Quoted 5 lines

The problem is that MPOL_NOOP is not defined in policy_modes[] so we search past the end of the array.

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>