Re: [PATCH 7/8] posix_types.h: add __kernel_uintptr_t to UAPI posix_types.h

From: Masahiro Yamada
Date: Mon Apr 04 2022 - 07:52:55 EST


On Mon, Apr 4, 2022 at 8:31 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Masahiro,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on linux/master v5.18-rc1 next-20220404]
> [cannot apply to soc/for-next drm/drm-next powerpc/next uclinux-h8/h8300-next s390/features arnd-asm-generic/master]
> [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]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Masahiro-Yamada/UAPI-make-more-exported-headers-self-contained-and-put-them-into-test-coverage/20220404-142226
> base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git be2d3ecedd9911fbfd7e55cc9ceac5f8b79ae4cf
> config: i386-randconfig-a006 (https://download.01.org/0day-ci/archive/20220404/202204041919.bIUKxOch-lkp@xxxxxxxxx/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
> 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/intel-lab-lkp/linux/commit/e8154d995f34b79843e473d85645fb543d554e7f
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Masahiro-Yamada/UAPI-make-more-exported-headers-self-contained-and-put-them-into-test-coverage/20220404-142226
> git checkout e8154d995f34b79843e473d85645fb543d554e7f
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash sound/soc/fsl/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> >> sound/soc/fsl/imx-audmux.c:148:40: warning: format specifies type 'unsigned long' but the argument has type 'uintptr_t' (aka 'unsigned int') [-Wformat]
> snprintf(buf, sizeof(buf), "ssi%lu", i);
> ~~~ ^
> %u
> 1 warning generated.
>

Hmm, we highly relied on the fact that the pointer size and
the 'long' size are the same.
(for both 32-bit and 64-bit).

So, using %lu specifier for printing 'uintptr_t' seems correct.

typedef unsigned long __kernel_uintptr_t;

is OK from the kernel space perspective,
but I do not know the impact to the userspace.

Arnd, any thoughts?






> vim +148 sound/soc/fsl/imx-audmux.c
>
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 139
> b8909783a22b4f sound/soc/fsl/imx-audmux.c Lars-Peter Clausen 2014-04-24 140 static void audmux_debugfs_init(void)
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 141 {
> e5f89768e9bc1f sound/soc/fsl/imx-audmux.c Mark Brown 2014-08-01 142 uintptr_t i;
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 143 char buf[20];
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 144
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 145 audmux_debugfs_root = debugfs_create_dir("audmux", NULL);
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 146
> 409b78cc17a4a3 sound/soc/fsl/imx-audmux.c Torben Hohn 2012-07-18 147 for (i = 0; i < MX31_AUDMUX_PORT7_SSI_PINS_7 + 1; i++) {
> e5f89768e9bc1f sound/soc/fsl/imx-audmux.c Mark Brown 2014-08-01 @148 snprintf(buf, sizeof(buf), "ssi%lu", i);
> 227ab8baa15bdd sound/soc/fsl/imx-audmux.c Greg Kroah-Hartman 2019-06-14 149 debugfs_create_file(buf, 0444, audmux_debugfs_root,
> 227ab8baa15bdd sound/soc/fsl/imx-audmux.c Greg Kroah-Hartman 2019-06-14 150 (void *)i, &audmux_debugfs_fops);
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 151 }
> 7b4e08a77f0cbf arch/arm/plat-mxc/audmux-v2.c Mark Brown 2010-01-11 152 }
> 3bc34a6143359d arch/arm/plat-mxc/audmux.c Richard Zhao 2012-03-05 153
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp



--
Best Regards
Masahiro Yamada