Skip to contentSkip to conversation

Mempolicy: fix mpol_to_str() to handle ignore mode flags

PATCH New Lee Schermerhorn 1 participant 1 message Apr 17, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mempolicy: fix mpol_to_str() to handle ignore mode flags

Against: 2.6.25-rc8-mm1

Fixes problem introduced by my previous patch:
mempolicy-use-mpol_f_local-to-indicate-preferred-local-policy.patch

Eliminate display of bogus '=' flag indicator in presence of internal mode flags.

Without this fix, on 25-rc8-mm1, a display of a process' numa_maps will show, e.g., default policy as "default=". Worse, if the maps include longer policies, such as "interleave:0-3", this problem will lose the string terminator after the "<mode>=" and display subsequent default policies as "default=ve:0-3".

 mm/mempolicy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -1
Index: linux-2.6.25-rc8-mm2/mm/mempolicy.c
===================================================================
@@ -2149,7 +2149,7 @@ int mpol_to_str(char *buffer, int maxlen
 	strcpy(p, policy_types[mode]);
 	p += l;
 
-	if (flags) {
+	if (flags & MPOL_MODE_FLAGS) {
 		if (buffer + maxlen < p + 2)
 			return -ENOSPC;
 		*p++ = '=';

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