drivers/nvme/host/core.c:3109:44: sparse: sparse: invalid assignment: &=

From: kernel test robot
Date: Fri Feb 24 2023 - 09:13:51 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d2980d8d826554fa6981d621e569a453787472f8
commit: baff6491448b487e920faaa117e432989cbafa89 nvme: mask CSE effects for security receive
date: 3 weeks ago
config: m68k-randconfig-s051-20230222 (https://download.01.org/0day-ci/archive/20230224/202302242222.PevBhzvC-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=baff6491448b487e920faaa117e432989cbafa89
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout baff6491448b487e920faaa117e432989cbafa89
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k SHELL=/bin/bash drivers/nvme/host/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202302242222.PevBhzvC-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/host/core.c:3109:44: sparse: sparse: invalid assignment: &=
>> drivers/nvme/host/core.c:3109:44: sparse: left side has type restricted __le32
>> drivers/nvme/host/core.c:3109:44: sparse: right side has type int

vim +3109 drivers/nvme/host/core.c

3083
3084 static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl)
3085 {
3086 struct nvme_effects_log *log = ctrl->effects;
3087
3088 log->acs[nvme_admin_format_nvm] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC |
3089 NVME_CMD_EFFECTS_NCC |
3090 NVME_CMD_EFFECTS_CSE_MASK);
3091 log->acs[nvme_admin_sanitize_nvm] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC |
3092 NVME_CMD_EFFECTS_CSE_MASK);
3093
3094 /*
3095 * The spec says the result of a security receive command depends on
3096 * the previous security send command. As such, many vendors log this
3097 * command as one to submitted only when no other commands to the same
3098 * namespace are outstanding. The intention is to tell the host to
3099 * prevent mixing security send and receive.
3100 *
3101 * This driver can only enforce such exclusive access against IO
3102 * queues, though. We are not readily able to enforce such a rule for
3103 * two commands to the admin queue, which is the only queue that
3104 * matters for this command.
3105 *
3106 * Rather than blindly freezing the IO queues for this effect that
3107 * doesn't even apply to IO, mask it off.
3108 */
> 3109 log->acs[nvme_admin_security_recv] &= ~NVME_CMD_EFFECTS_CSE_MASK;
3110
3111 log->iocs[nvme_cmd_write] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC);
3112 log->iocs[nvme_cmd_write_zeroes] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC);
3113 log->iocs[nvme_cmd_write_uncor] |= cpu_to_le32(NVME_CMD_EFFECTS_LBCC);
3114 }
3115

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