[PATCH] powerpc: Simplify access_ok()

kernel test robot lkp at intel.com
Sun Mar 22 09:33:29 AEDT 2026


Hi Christophe,

kernel test robot noticed the following build errors:

[auto build test ERROR on v7.0-rc3]
[cannot apply to powerpc/next powerpc/fixes v7.0-rc4 linus/master next-20260320]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy-CS-GROUP/powerpc-Simplify-access_ok/20260318-080252
base:   v7.0-rc3
patch link:    https://lore.kernel.org/r/56dd1a892279fade2292b7eef7a52112901ae2fd.1773770778.git.chleroy%40kernel.org
patch subject: [PATCH] powerpc: Simplify access_ok()
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20260322/202603220648.5ZKgsQIu-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260322/202603220648.5ZKgsQIu-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603220648.5ZKgsQIu-lkp@intel.com/

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

   In file included from include/linux/uaccess.h:13,
                    from include/linux/sched/task.h:13,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs/super_types.h:13,
                    from include/linux/fs/super.h:5,
                    from include/linux/fs.h:5,
                    from include/linux/compat.h:17,
                    from arch/powerpc/kernel/asm-offsets.c:13:
   arch/powerpc/include/asm/uaccess.h: In function '__access_ok':
>> arch/powerpc/include/asm/uaccess.h:42:77: error: expected ';' before ')' token
      42 |                         return size <= TASK_SIZE && addr <= TASK_SIZE - size);
         |                                                                             ^
         |                                                                             ;
>> arch/powerpc/include/asm/uaccess.h:41:17: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
      41 |                 else
         |                 ^~~~
   arch/powerpc/include/asm/uaccess.h:42:77: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
      42 |                         return size <= TASK_SIZE && addr <= TASK_SIZE - size);
         |                                                                             ^
>> arch/powerpc/include/asm/uaccess.h:42:77: error: expected statement before ')' token
   make[3]: *** [scripts/Makefile.build:184: arch/powerpc/kernel/asm-offsets.s] Error 1
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1333: prepare0] Error 2
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:248: __sub-make] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:248: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


vim +42 arch/powerpc/include/asm/uaccess.h

    21	
    22	/*
    23	 * On powerpc64, TASK_SIZE_MAX is 0x0010000000000000 then even if both ptr and size
    24	 * are TASK_SIZE_MAX we are still inside the memory gap. So make it simple.
    25	 */
    26	static __always_inline int __access_ok(const void __user *ptr, unsigned long size)
    27	{
    28		unsigned long addr = (unsigned long)ptr;
    29	
    30		if (IS_ENABLED(CONFIG_PPC64)) {
    31			BUILD_BUG_ON(!is_power_of_2(TASK_SIZE_MAX));
    32			BUILD_BUG_ON(TASK_SIZE_MAX > 0x0010000000000000);
    33	
    34			if (__builtin_constant_p(size))
    35				return size <= TASK_SIZE_MAX && !(addr & ~(TASK_SIZE_MAX - 1));
    36			else
    37				return !((size | addr) & ~(TASK_SIZE_MAX - 1));
    38		} else {
    39			if (__builtin_constant_p(size) && size < SZ_128K)
    40				return addr < TASK_SIZE;
  > 41			else
  > 42				return size <= TASK_SIZE && addr <= TASK_SIZE - size);
    43		}
    44	}
    45	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


More information about the Linuxppc-dev mailing list