Re: [PATCH 3/8] smb: client: allow creating symlinks via reparse points

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paulo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on next-20231124]
[cannot apply to linus/master v6.7-rc2]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paulo-Alcantara/smb-client-extend-smb2_compound_op-to-accept-more-commands/20231126-061137
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
patch link:    https://lore.kernel.org/r/20231125220813.30538-4-pc%40manguebit.com
patch subject: [PATCH 3/8] smb: client: allow creating symlinks via reparse points
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231126/202311260838.nx5mkj1j-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231126/202311260838.nx5mkj1j-lkp@xxxxxxxxx/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
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311260838.nx5mkj1j-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> fs/smb/client/smb2ops.c:5267:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!IS_ERR(new))
               ^~~~~~~~~~~~
   fs/smb/client/smb2ops.c:5275:9: note: uninitialized use occurs here
           return rc;
                  ^~
   fs/smb/client/smb2ops.c:5267:2: note: remove the 'if' if its condition is always false
           if (!IS_ERR(new))
           ^~~~~~~~~~~~~~~~~
   fs/smb/client/smb2ops.c:5227:8: note: initialize the variable 'rc' to silence this warning
           int rc;
                 ^
                  = 0
   1 warning generated.


vim +5267 fs/smb/client/smb2ops.c

  5211	
  5212	static int smb2_create_reparse_symlink(const unsigned int xid,
  5213					       struct inode *inode,
  5214					       struct dentry *dentry,
  5215					       struct cifs_tcon *tcon,
  5216					       const char *full_path,
  5217					       const char *symname)
  5218	{
  5219		struct reparse_symlink_data_buffer *buf = NULL;
  5220		struct cifs_open_info_data data;
  5221		struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
  5222		struct inode *new;
  5223		struct kvec iov;
  5224		__le16 *path;
  5225		char *sym;
  5226		u16 len, plen;
  5227		int rc;
  5228	
  5229		sym = kstrdup(symname, GFP_KERNEL);
  5230		if (!sym)
  5231			return -ENOMEM;
  5232	
  5233		data = (struct cifs_open_info_data) {
  5234			.reparse_point = true,
  5235			.reparse = { .tag = IO_REPARSE_TAG_SYMLINK, },
  5236			.symlink_target = sym,
  5237		};
  5238	
  5239		path = cifs_convert_path_to_utf16(symname, cifs_sb);
  5240		if (!path) {
  5241			rc = -ENOMEM;
  5242			goto out;
  5243		}
  5244	
  5245		plen = 2 * UniStrnlen((wchar_t *)path, PATH_MAX);
  5246		len = sizeof(*buf) + plen * 2;
  5247		buf = kzalloc(len, GFP_KERNEL);
  5248		if (!buf) {
  5249			rc = -ENOMEM;
  5250			goto out;
  5251		}
  5252	
  5253		buf->ReparseTag = cpu_to_le32(IO_REPARSE_TAG_SYMLINK);
  5254		buf->ReparseDataLength = cpu_to_le16(len - sizeof(struct reparse_data_buffer));
  5255		buf->SubstituteNameOffset = cpu_to_le16(plen);
  5256		buf->SubstituteNameLength = cpu_to_le16(plen);
  5257		memcpy((u8 *)buf->PathBuffer + plen, path, plen);
  5258		buf->PrintNameOffset = 0;
  5259		buf->PrintNameLength = cpu_to_le16(plen);
  5260		memcpy(buf->PathBuffer, path, plen);
  5261		buf->Flags = cpu_to_le32(*symname != '/' ? SYMLINK_FLAG_RELATIVE : 0);
  5262	
  5263		iov.iov_base = buf;
  5264		iov.iov_len = len;
  5265		new = smb2_get_reparse_inode(&data, inode->i_sb, xid,
  5266					     tcon, full_path, &iov);
> 5267		if (!IS_ERR(new))
  5268			d_instantiate(dentry, new);
  5269		else
  5270			rc = PTR_ERR(new);
  5271	out:
  5272		kfree(path);
  5273		cifs_free_open_info(&data);
  5274		kfree(buf);
  5275		return rc;
  5276	}
  5277	

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




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux