Commit 1334be36 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds
Browse files

mm: fix nodemask printing

The cleanup caused build warnings for constant mask pointers:

  mm/mempolicy.c: In function `mpol_to_str':
  ./include/linux/nodemask.h:108:11: warning: the comparison will always evaluate as `true' for the address of `nodes' will never be NULL [-Waddress]

An earlier workaround I suggested was incorporated in the version that
got merged, but that only solved the problem for gcc-7 and higher, while
gcc-4.6 through gcc-6.x still warn.

This changes the printing again to use inline functions that make it
clear to the compiler that the line that does the NULL check has no idea
whether the argument is a constant NULL.

Fixes: 0205f755

 ("mm: simplify nodemask printing")
Signed-off-by: default avatarArnd Bergmann <>
Cc: Michal Hocko <>
Cc: Stephen Rothwell <>
Cc: Zhangshaokun <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent a3841f94
......@@ -104,9 +104,16 @@ extern nodemask_t _unused_nodemask_arg_;
* Can be used to provide arguments for '%*pb[l]' when printing a nodemask.
#define nodemask_pr_args(maskp) \
((maskp) != NULL) ? MAX_NUMNODES : 0, \
((maskp) != NULL) ? (maskp)->bits : NULL
#define nodemask_pr_args(maskp) __nodemask_pr_numnodes(maskp), \
static inline unsigned int __nodemask_pr_numnodes(const nodemask_t *m)
return m ? MAX_NUMNODES : 0;
static inline const unsigned long *__nodemask_pr_bits(const nodemask_t *m)
return m ? m->bits : NULL;
* The inline keyword gives the compiler room to decide to inline, or
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