Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm, mempolicy: silence gcc warning

Fengguang Wu reports that compiling mm/mempolicy.c results in a warning:

mm/mempolicy.c: In function 'mpol_to_str':
mm/mempolicy.c:2878:2: error: format not a string literal and no format arguments

Kees says this is because he is using -Wformat-security.

Silence the warning.

Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Suggested-by: Kees Cook <keescook@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Rientjes and committed by
Linus Torvalds
b7a9f420 49204c11

+1 -1
+1 -1
mm/mempolicy.c
··· 2950 2950 return; 2951 2951 } 2952 2952 2953 - p += snprintf(p, maxlen, policy_modes[mode]); 2953 + p += snprintf(p, maxlen, "%s", policy_modes[mode]); 2954 2954 2955 2955 if (flags & MPOL_MODE_FLAGS) { 2956 2956 p += snprintf(p, buffer + maxlen - p, "=");