Mailing List Archive

[mchinth:sep_socwatch_linux_5_9 1/1] drivers/platform/x86/sepdk/pax/pax.c:748:18: sparse: sparse: cast removes address space '__user' of expression
Hi Manisha,

First bad commit (maybe != root cause):

tree: https://github.com/mchinth/linux sep_socwatch_linux_5_9
head: c859e634bf058e7963fccc4c1219c1365e925ad4
commit: c859e634bf058e7963fccc4c1219c1365e925ad4 [1/1] platform/x86: Update SEP driver for 5.9 pull
config: x86_64-randconfig-s022-20210803 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-348-gf0e6938b-dirty
# https://github.com/mchinth/linux/commit/c859e634bf058e7963fccc4c1219c1365e925ad4
git remote add mchinth https://github.com/mchinth/linux
git fetch --no-tags mchinth sep_socwatch_linux_5_9
git checkout c859e634bf058e7963fccc4c1219c1365e925ad4
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/x86/sepdk/pax/ drivers/platform/x86/sepdk/sep/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/platform/x86/sepdk/pax/pax.c:748:18: sparse: sparse: cast removes address space '__user' of expression
drivers/platform/x86/sepdk/pax/pax.c:750:18: sparse: sparse: cast removes address space '__user' of expression
--
drivers/platform/x86/sepdk/sep/lwpmudrv.c: note: in included file (through drivers/platform/x86/sepdk/inc/apic.h):
/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:406:9: sparse: sparse: preprocessor token offsetof redefined
drivers/platform/x86/sepdk/sep/lwpmudrv.c: note: in included file (through include/uapi/linux/posix_types.h, include/uapi/linux/types.h, include/linux/types.h, ...):
include/linux/stddef.h:17:9: sparse: this was the original definition
>> drivers/platform/x86/sepdk/sep/lwpmudrv.c:7127:18: sparse: sparse: cast removes address space '__user' of expression
drivers/platform/x86/sepdk/sep/lwpmudrv.c:7129:18: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +748 drivers/platform/x86/sepdk/pax/pax.c

d605aabab41663 Jon Moeller 2018-11-13 726
d605aabab41663 Jon Moeller 2018-11-13 727 #if defined(CONFIG_COMPAT) && defined(DRV_EM64T)
d605aabab41663 Jon Moeller 2018-11-13 728 static IOCTL_OP_TYPE pax_Device_Control_Compat(struct file *filp,
d605aabab41663 Jon Moeller 2018-11-13 729 unsigned int cmd,
d605aabab41663 Jon Moeller 2018-11-13 730 unsigned long arg)
d605aabab41663 Jon Moeller 2018-11-13 731 {
d605aabab41663 Jon Moeller 2018-11-13 732 int status = OS_SUCCESS;
d605aabab41663 Jon Moeller 2018-11-13 733 IOCTL_COMPAT_ARGS_NODE local_args_compat;
d605aabab41663 Jon Moeller 2018-11-13 734 IOCTL_ARGS_NODE local_args;
d605aabab41663 Jon Moeller 2018-11-13 735
d605aabab41663 Jon Moeller 2018-11-13 736 memset(&local_args_compat, 0, sizeof(IOCTL_COMPAT_ARGS_NODE));
d605aabab41663 Jon Moeller 2018-11-13 737 if (arg) {
d605aabab41663 Jon Moeller 2018-11-13 738 status = copy_from_user(&local_args_compat,
d605aabab41663 Jon Moeller 2018-11-13 739 (void __user *)arg,
d605aabab41663 Jon Moeller 2018-11-13 740 sizeof(IOCTL_COMPAT_ARGS_NODE));
d605aabab41663 Jon Moeller 2018-11-13 741 if (status != OS_SUCCESS)
d605aabab41663 Jon Moeller 2018-11-13 742 return status;
d605aabab41663 Jon Moeller 2018-11-13 743 }
d605aabab41663 Jon Moeller 2018-11-13 744
d605aabab41663 Jon Moeller 2018-11-13 745 local_args.len_drv_to_usr = local_args_compat.len_drv_to_usr;
d605aabab41663 Jon Moeller 2018-11-13 746 local_args.len_usr_to_drv = local_args_compat.len_usr_to_drv;
d605aabab41663 Jon Moeller 2018-11-13 747 local_args.buf_drv_to_usr =
d605aabab41663 Jon Moeller 2018-11-13 @748 (char *)compat_ptr(local_args_compat.buf_drv_to_usr);
d605aabab41663 Jon Moeller 2018-11-13 749 local_args.buf_usr_to_drv =
d605aabab41663 Jon Moeller 2018-11-13 750 (char *)compat_ptr(local_args_compat.buf_usr_to_drv);
d605aabab41663 Jon Moeller 2018-11-13 751
d605aabab41663 Jon Moeller 2018-11-13 752 local_args.command = cmd;
d605aabab41663 Jon Moeller 2018-11-13 753
d605aabab41663 Jon Moeller 2018-11-13 754 status = pax_Service_IOCTL(filp, cmd, local_args);
d605aabab41663 Jon Moeller 2018-11-13 755
d605aabab41663 Jon Moeller 2018-11-13 756 return status;
d605aabab41663 Jon Moeller 2018-11-13 757 }
d605aabab41663 Jon Moeller 2018-11-13 758 #endif
d605aabab41663 Jon Moeller 2018-11-13 759

:::::: The code at line 748 was first introduced by commit
:::::: d605aabab41663c9be9e8c549042933189adbf2f platform/x86: add sep and socwatch drivers without socperf.

:::::: TO: Jon Moeller <jon.moeller@intel.com>
:::::: CC: Faycal Benmlih <faycal.benmlih@intel.com>

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