Re: [PATCH] nvmet: fix mismatched serial

From: kernel test robot
Date: Fri Dec 11 2020 - 12:41:44 EST


Hi zhenwei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc7 next-20201211]
[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/zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
base: git://git.infradead.org/users/hch/configfs.git for-next
config: openrisc-randconfig-s031-20201209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.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.3-179-ga00755aa-dirty
# https://github.com/0day-ci/linux/commit/57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
git checkout 57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/nvme/target/configfs.c:1000:52: sparse: sparse: cast to restricted __be64
>> drivers/nvme/target/configfs.c:1012:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] serial @@ got restricted __be64 [usertype] @@
drivers/nvme/target/configfs.c:1012:33: sparse: expected unsigned long long [usertype] serial
drivers/nvme/target/configfs.c:1012:33: sparse: got restricted __be64 [usertype]

vim +1000 drivers/nvme/target/configfs.c

994
995 static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
996 char *page)
997 {
998 struct nvmet_subsys *subsys = to_subsys(item);
999
> 1000 return snprintf(page, PAGE_SIZE, "%llx\n", be64_to_cpu(subsys->serial));
1001 }
1002
1003 static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
1004 const char *page, size_t count)
1005 {
1006 u64 serial;
1007
1008 if (sscanf(page, "%llx\n", &serial) != 1)
1009 return -EINVAL;
1010
1011 down_write(&nvmet_config_sem);
> 1012 to_subsys(item)->serial = cpu_to_be64(serial);
1013 up_write(&nvmet_config_sem);
1014
1015 return count;
1016 }
1017 CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
1018

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

Attachment: .config.gz
Description: application/gzip