Re: [PATCH] mm/vmalloc: warn only once when vmalloc detect invalid gfp flags

kernel test robot
2025-11-18T00:54:14Z

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on 0c1c7a6a83feaf2cf182c52983ffe330ffb50280]

url: https://github.com/intel-lab-lkp/linux/commits/David-Heidelberg-via-B4-Relay/mm-vmalloc-warn-only-once-when-vmalloc-detect-invalid-gfp-flags/20251118-080722
base: 0c1c7a6a83feaf2cf182c52983ffe330ffb50280
patch link: https://lore.kernel.org/r/20251118-only-one-vmalloc-v1-1-29f8eacb4605%40ixit.cz
patch subject: [PATCH] mm/vmalloc: warn only once when vmalloc detect invalid gfp flags
config: alpha-allnoconfig (https://download.01.org/0day-ci/archive/20251118/202511180838.vEBLp7Hm-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251118/202511180838.vEBLp7Hm-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511180838.vEBLp7Hm-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

In file included from arch/alpha/include/asm/bug.h:23,
from include/linux/bug.h:5,
from include/linux/alloc_tag.h:8,
from include/linux/vmalloc.h:5,
from mm/vmalloc.c:11:
mm/vmalloc.c: In function 'vmalloc_fix_flags':
>> mm/vmalloc.c:3938:19: error: expected ')' before 'invalid_mask'
3938 | invalid_mask, &invalid_mask, flags, &flags);
| ^~~~~~~~~~~~
include/asm-generic/bug.h:105:62: note: in definition of macro '__WARN_printf'
105 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^~~
include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
include/asm-generic/bug.h:159:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
159 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/vmalloc.c:3937:9: note: in expansion of macro 'WARN_ONCE'
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~
include/asm-generic/bug.h:105:34: note: to match this '('
105 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^
include/asm-generic/bug.h:141:17: note: in expansion of macro '__WARN_printf'
141 | __WARN_printf(TAINT_WARN, format); \
| ^~~~~~~~~~~~~
include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
include/asm-generic/bug.h:159:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
159 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/vmalloc.c:3937:9: note: in expansion of macro 'WARN_ONCE'
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~
>> mm/vmalloc.c:3937:22: warning: format '%x' expects a matching 'unsigned int' argument [-Wformat=]
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:105:62: note: in definition of macro '__WARN_printf'
105 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^~~
include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
include/asm-generic/bug.h:159:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
159 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/vmalloc.c:3937:9: note: in expansion of macro 'WARN_ONCE'
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~
mm/vmalloc.c:3937:41: note: format string is defined here
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ~~^
| |
| unsigned int
>> mm/vmalloc.c:3937:22: warning: format '%p' expects a matching 'void *' argument [-Wformat=]
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:105:62: note: in definition of macro '__WARN_printf'
105 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^~~
include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
include/asm-generic/bug.h:159:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
159 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/vmalloc.c:3937:9: note: in expansion of macro 'WARN_ONCE'
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~
mm/vmalloc.c:3937:45: note: format string is defined here
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ~^
| |
| void *
>> mm/vmalloc.c:3937:22: warning: format '%x' expects a matching 'unsigned int' argument [-Wformat=]
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:105:62: note: in definition of macro '__WARN_printf'
105 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^~~
include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
include/asm-generic/bug.h:159:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
159 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/vmalloc.c:3937:9: note: in expansion of macro 'WARN_ONCE'
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~
mm/vmalloc.c:3937:71: note: format string is defined here
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ~~^
| |
| unsigned int
>> mm/vmalloc.c:3937:22: warning: format '%p' expects a matching 'void *' argument [-Wformat=]
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:105:62: note: in definition of macro '__WARN_printf'
105 | warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
| ^~~
include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
include/asm-generic/bug.h:159:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
159 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/vmalloc.c:3937:9: note: in expansion of macro 'WARN_ONCE'
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ^~~~~~~~~
mm/vmalloc.c:3937:75: note: format string is defined here
3937 | WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
| ~^
| |
| void *
>> mm/vmalloc.c:3934:15: warning: unused variable 'invalid_mask' [-Wunused-variable]
3934 | gfp_t invalid_mask = flags & ~GFP_VMALLOC_SUPPORTED;
| ^~~~~~~~~~~~

vim +3938 mm/vmalloc.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 3921
7179b225631532 Vishal Moola (Oracle 2025-11-12 3922) /*
7179b225631532 Vishal Moola (Oracle 2025-11-12 3923) * See __vmalloc_node_range() for a clear list of supported vmalloc flags.
7179b225631532 Vishal Moola (Oracle 2025-11-12 3924) * This gfp lists all flags currently passed through vmalloc. Currently,
7179b225631532 Vishal Moola (Oracle 2025-11-12 3925) * __GFP_ZERO is used by BPF and __GFP_NORETRY is used by percpu. Both drm
7179b225631532 Vishal Moola (Oracle 2025-11-12 3926) * and BPF also use GFP_USER, which is GFP_KERNEL | __GFP_HARDWALL.
7179b225631532 Vishal Moola (Oracle 2025-11-12 3927) */
7179b225631532 Vishal Moola (Oracle 2025-11-12 3928) #define GFP_VMALLOC_SUPPORTED (GFP_KERNEL | GFP_ATOMIC | GFP_NOWAIT |\
7179b225631532 Vishal Moola (Oracle 2025-11-12 3929) __GFP_NOFAIL | __GFP_ZERO | __GFP_NORETRY |\
7179b225631532 Vishal Moola (Oracle 2025-11-12 3930) __GFP_HARDWALL)
7179b225631532 Vishal Moola (Oracle 2025-11-12 3931)
7179b225631532 Vishal Moola (Oracle 2025-11-12 3932) static gfp_t vmalloc_fix_flags(gfp_t flags)
7179b225631532 Vishal Moola (Oracle 2025-11-12 3933) {
7179b225631532 Vishal Moola (Oracle 2025-11-12 @3934) gfp_t invalid_mask = flags & ~GFP_VMALLOC_SUPPORTED;
7179b225631532 Vishal Moola (Oracle 2025-11-12 3935)
7179b225631532 Vishal Moola (Oracle 2025-11-12 3936) flags &= GFP_VMALLOC_SUPPORTED;
bf791000a32caf David Heidelberg 2025-11-18 @3937 WARN_ONCE(1, "Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n"
7179b225631532 Vishal Moola (Oracle 2025-11-12 @3938) invalid_mask, &invalid_mask, flags, &flags);
7179b225631532 Vishal Moola (Oracle 2025-11-12 3939) return flags;
7179b225631532 Vishal Moola (Oracle 2025-11-12 3940) }
7179b225631532 Vishal Moola (Oracle 2025-11-12 3941)

--
0-DAY CI Kernel Test Service