Re: [PATCH] mm/mempolicy: do not allow illegal MPOL_F_NUMA_BALANCING | MPOL_LOCAL in mbind()

From: kernel test robot
Date: Fri Oct 01 2021 - 16:25:09 EST


Hi Eric,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]

url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/mm-mempolicy-do-not-allow-illegal-MPOL_F_NUMA_BALANCING-MPOL_LOCAL-in-mbind/20211002-015054
base: https://github.com/hnaz/linux-mm master
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/fe87354835a4bf5cad6d885f0ba558c767fee6f1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-Dumazet/mm-mempolicy-do-not-allow-illegal-MPOL_F_NUMA_BALANCING-MPOL_LOCAL-in-mbind/20211002-015054
git checkout fe87354835a4bf5cad6d885f0ba558c767fee6f1
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

mm/mempolicy.c: In function 'sanitize_mpol_flags':
>> mm/mempolicy.c:1452:26: warning: comparison between pointer and integer
1452 | if (mode != MPOL_BIND)
| ^~


vim +1452 mm/mempolicy.c

1440
1441 /* Basic parameter sanity check used by both mbind() and set_mempolicy() */
1442 static inline int sanitize_mpol_flags(int *mode, unsigned short *flags)
1443 {
1444 *flags = *mode & MPOL_MODE_FLAGS;
1445 *mode &= ~MPOL_MODE_FLAGS;
1446
1447 if ((unsigned int)(*mode) >= MPOL_MAX)
1448 return -EINVAL;
1449 if ((*flags & MPOL_F_STATIC_NODES) && (*flags & MPOL_F_RELATIVE_NODES))
1450 return -EINVAL;
1451 if (*flags & MPOL_F_NUMA_BALANCING) {
> 1452 if (mode != MPOL_BIND)
1453 return -EINVAL;
1454 *flags |= (MPOL_F_MOF | MPOL_F_MORON);
1455 }
1456 return 0;
1457 }
1458

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip