All of lore.kernel.org
 help / color / mirror / Atom feed
* fs/smb/client/dir.c:1107:52: sparse: sparse: Initializer entry defined twice
@ 2026-12-03 22:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-12-03 22:52 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "sparse: Initializer entry defined twice"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Paulo Alcantara <pc@manguebit.org>
CC: Steve French <stfrench@microsoft.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   007722b8211f7b34fdf21b1e6a9c32497633ea29
commit: 3e7d63037a2b1715f70b7454630f3b2b8a922ec8 smb: client: add support for O_TMPFILE
date:   8 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-r2311-20261203 (https://download.01.org/0day-ci/archive/20261203/20261203234845.2ZautP1d-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
sparse: v0.6.5-rc1-94-g0d159c10
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203234845.2ZautP1d-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 3e7d63037a2b ("smb: client: add support for O_TMPFILE")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/20261203234845.2ZautP1d-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/smb/client/dir.c:1107:52: sparse: sparse: Initializer entry defined twice
   fs/smb/client/dir.c:1107:52: sparse:   also defined here
   fs/smb/client/dir.c:1168:42: sparse: sparse: Initializer entry defined twice
   fs/smb/client/dir.c:1168:42: sparse:   also defined here

vim +1107 fs/smb/client/dir.c

3e7d63037a2b17 Paulo Alcantara 2026-04-07  1040  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1041  /*
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1042   * Create a hidden temporary CIFS file with delete-on-close bit set.
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1043   *
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1044   * The initial dentry state is unhashed-negative.  On success, dentry will
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1045   * become unhashed-positive by calling d_drop() & d_instantiate(), respectively.
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1046   */
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1047  int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1048  		 struct file *file, umode_t mode)
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1049  {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1050  	struct dentry *dentry = file->f_path.dentry;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1051  	struct cifs_sb_info *cifs_sb = CIFS_SB(dir);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1052  	size_t size = CIFS_TMPNAME_LEN + 1;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1053  	int retries = 0, max_retries = 16;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1054  	struct TCP_Server_Info *server;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1055  	struct cifs_pending_open open;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1056  	struct cifsFileInfo *cfile;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1057  	struct cifs_fid fid = {};
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1058  	struct tcon_link *tlink;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1059  	struct cifs_tcon *tcon;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1060  	unsigned int sbflags;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1061  	struct inode *inode;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1062  	char *path, *name;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1063  	unsigned int xid;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1064  	__u32 oplock;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1065  	int rc;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1066  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1067  	if (unlikely(cifs_forced_shutdown(cifs_sb)))
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1068  		return smb_EIO(smb_eio_trace_forced_shutdown);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1069  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1070  	tlink = cifs_sb_tlink(cifs_sb);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1071  	if (IS_ERR(tlink))
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1072  		return PTR_ERR(tlink);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1073  	tcon = tlink_tcon(tlink);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1074  	server = tcon->ses->server;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1075  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1076  	xid = get_xid();
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1077  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1078  	if (server->vals->protocol_id < SMB20_PROT_ID) {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1079  		cifs_dbg(VFS | ONCE, "O_TMPFILE is supported only in SMB2+\n");
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1080  		rc = -EOPNOTSUPP;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1081  		goto out;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1082  	}
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1083  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1084  	if (server->ops->new_lease_key)
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1085  		server->ops->new_lease_key(&fid);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1086  	cifs_add_pending_open(&fid, tlink, &open);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1087  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1088  	path = alloc_parent_path(dentry, size - 1);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1089  	if (IS_ERR(path)) {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1090  		cifs_del_pending_open(&open);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1091  		rc = PTR_ERR(path);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1092  		goto out;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1093  	}
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1094  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1095  	name = path + strlen(path);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1096  	do {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1097  		scnprintf(name, size,
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1098  			  CIFS_TMPNAME_PREFIX "%0*x",
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1099  			  CIFS_TMPNAME_COUNTER_LEN,
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1100  			  atomic_inc_return(&cifs_tmpcounter));
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1101  		rc = __cifs_do_create(dir, dentry, path, xid, tlink,
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1102  				      file->f_flags, mode, &oplock,
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1103  				      &fid, NULL, &inode);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1104  		if (!rc) {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1105  			set_nlink(inode, 0);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1106  			mark_inode_dirty(inode);
3e7d63037a2b17 Paulo Alcantara 2026-04-07 @1107  			d_mark_tmpfile_name(file, &QSTR_LEN(name, size - 1));
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1108  			d_instantiate(dentry, inode);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1109  			break;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1110  		}
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1111  	} while (unlikely(rc == -EEXIST) && ++retries < max_retries);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1112  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1113  	kfree(path);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1114  	if (rc) {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1115  		cifs_del_pending_open(&open);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1116  		goto out;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1117  	}
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1118  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1119  	rc = finish_open(file, dentry, generic_file_open);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1120  	if (rc)
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1121  		goto err_open;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1122  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1123  	sbflags = cifs_sb_flags(cifs_sb);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1124  	if ((file->f_flags & O_DIRECT) && (sbflags & CIFS_MOUNT_STRICT_IO)) {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1125  		if (sbflags & CIFS_MOUNT_NO_BRL)
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1126  			file->f_op = &cifs_file_direct_nobrl_ops;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1127  		else
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1128  			file->f_op = &cifs_file_direct_ops;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1129  	}
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1130  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1131  	cfile = cifs_new_fileinfo(&fid, file, tlink, oplock, NULL);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1132  	if (!cfile) {
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1133  		rc = -ENOMEM;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1134  		goto err_open;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1135  	}
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1136  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1137  	rc = set_hidden_attr(xid, server, file);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1138  	if (rc)
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1139  		goto out;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1140  
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1141  	fscache_use_cookie(cifs_inode_cookie(file_inode(file)),
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1142  			   file->f_mode & FMODE_WRITE);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1143  out:
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1144  	cifs_put_tlink(tlink);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1145  	free_xid(xid);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1146  	return rc;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1147  err_open:
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1148  	cifs_del_pending_open(&open);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1149  	if (server->ops->close)
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1150  		server->ops->close(xid, tcon, &fid);
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1151  	goto out;
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1152  }
3e7d63037a2b17 Paulo Alcantara 2026-04-07  1153  

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 22:52 fs/smb/client/dir.c:1107:52: sparse: sparse: Initializer entry defined twice kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.