Re: [PATCH v2 10/20] linux/container_of.h: Remove unnecessary cast

From: kernel test robot
Date: Mon Nov 22 2021 - 12:40:08 EST


Hi Alejandro,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.16-rc2 next-20211118]
[cannot apply to drm-intel/for-linux-next mkl-can-next/testing]
[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/0day-ci/linux/commits/Alejandro-Colomar/linux-stddef-h-linux-offsetof-h-Split-offsetof-into-a-separate-header/20211120-220144
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: mips-randconfig-s031-20211122 (attached as .config)
compiler: mips64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/ed03be33a3de1708b5a06ea31cc6cd8573890649
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alejandro-Colomar/linux-stddef-h-linux-offsetof-h-Split-offsetof-into-a-separate-header/20211120-220144
git checkout ed03be33a3de1708b5a06ea31cc6cd8573890649
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips

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


sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
arch/mips/kernel/signal.c:280:13: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:280:13: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:280:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int [noderef] __user *__pu_ptr @@ got unsigned int [usertype] * @@
arch/mips/kernel/signal.c:280:13: sparse: expected unsigned int [noderef] __user *__pu_ptr
arch/mips/kernel/signal.c:280:13: sparse: got unsigned int [usertype] *
arch/mips/kernel/signal.c:280:13: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:293:23: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:293:23: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:293:23: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const [noderef] __user *__gu_ptr @@ got unsigned int * @@
arch/mips/kernel/signal.c:293:23: sparse: expected unsigned int const [noderef] __user *__gu_ptr
arch/mips/kernel/signal.c:293:23: sparse: got unsigned int *
arch/mips/kernel/signal.c:300:23: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:300:23: sparse: sparse: cast removes address space '__user' of expression
arch/mips/kernel/signal.c:300:23: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const [noderef] __user *__gu_ptr @@ got unsigned int * @@
arch/mips/kernel/signal.c:300:23: sparse: expected unsigned int const [noderef] __user *__gu_ptr
arch/mips/kernel/signal.c:300:23: sparse: got unsigned int *
arch/mips/kernel/signal.c:667:17: sparse: sparse: symbol 'sys_rt_sigreturn' was not declared. Should it be static?
>> arch/mips/kernel/signal.c:157:14: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const *__mptr @@ got void [noderef] __user *sc @@
arch/mips/kernel/signal.c:157:14: sparse: expected void const *__mptr
arch/mips/kernel/signal.c:157:14: sparse: got void [noderef] __user *sc
arch/mips/kernel/signal.c:157:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct ucontext [noderef] __user *uc @@ got struct ucontext * @@
arch/mips/kernel/signal.c:157:12: sparse: expected struct ucontext [noderef] __user *uc
arch/mips/kernel/signal.c:157:12: sparse: got struct ucontext *
>> arch/mips/kernel/signal.c:157:14: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const *__mptr @@ got void [noderef] __user *sc @@
arch/mips/kernel/signal.c:157:14: sparse: expected void const *__mptr
arch/mips/kernel/signal.c:157:14: sparse: got void [noderef] __user *sc
arch/mips/kernel/signal.c:157:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct ucontext [noderef] __user *uc @@ got struct ucontext * @@
arch/mips/kernel/signal.c:157:12: sparse: expected struct ucontext [noderef] __user *uc
arch/mips/kernel/signal.c:157:12: sparse: got struct ucontext *

vim +157 arch/mips/kernel/signal.c

2db9ca0a355100 Paul Burton 2015-07-27 143
bf82cb30c7e58b Paul Burton 2015-07-27 144 /*
bf82cb30c7e58b Paul Burton 2015-07-27 145 * Extended context handling.
bf82cb30c7e58b Paul Burton 2015-07-27 146 */
bf82cb30c7e58b Paul Burton 2015-07-27 147
bf82cb30c7e58b Paul Burton 2015-07-27 148 static inline void __user *sc_to_extcontext(void __user *sc)
bf82cb30c7e58b Paul Burton 2015-07-27 149 {
bf82cb30c7e58b Paul Burton 2015-07-27 150 struct ucontext __user *uc;
bf82cb30c7e58b Paul Burton 2015-07-27 151
bf82cb30c7e58b Paul Burton 2015-07-27 152 /*
bf82cb30c7e58b Paul Burton 2015-07-27 153 * We can just pretend the sigcontext is always embedded in a struct
bf82cb30c7e58b Paul Burton 2015-07-27 154 * ucontext here, because the offset from sigcontext to extended
bf82cb30c7e58b Paul Burton 2015-07-27 155 * context is the same in the struct sigframe case.
bf82cb30c7e58b Paul Burton 2015-07-27 156 */
bf82cb30c7e58b Paul Burton 2015-07-27 @157 uc = container_of(sc, struct ucontext, uc_mcontext);
bf82cb30c7e58b Paul Burton 2015-07-27 158 return &uc->uc_extcontext;
bf82cb30c7e58b Paul Burton 2015-07-27 159 }
bf82cb30c7e58b Paul Burton 2015-07-27 160

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

Attachment: .config.gz
Description: application/gzip