[ammarfaizi2-block:dhowells/linux-fs/cifs-netfs 34/41] fs/cifs/smb2ops.c:3965:34: sparse: sparse: incorrect type in argument 2 (different base types)
From: kernel test robot
Date: Wed Jun 01 2022 - 03:18:02 EST
tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/cifs-netfs
head: 1fc71b6b30f6d2a981c163b77c9aee0aecaecb29
commit: 4c67a0e88c041546f0a045d5034e045e0c404918 [34/41] cifs: Share server EOF pos with netfslib
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220601/202206011525.hK4OI0FN-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-14-g5a0004b5-dirty
# https://github.com/ammarfaizi2/linux-block/commit/4c67a0e88c041546f0a045d5034e045e0c404918
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/cifs-netfs
git checkout 4c67a0e88c041546f0a045d5034e045e0c404918
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash fs/cifs/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> fs/cifs/smb2ops.c:3965:34: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected long long [usertype] new_i_size @@ got restricted __le64 [addressable] [assigned] [usertype] eof @@
fs/cifs/smb2ops.c:3965:34: sparse: expected long long [usertype] new_i_size
fs/cifs/smb2ops.c:3965:34: sparse: got restricted __le64 [addressable] [assigned] [usertype] eof
>> fs/cifs/smb2ops.c:3966:33: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected long long [usertype] newsize @@ got restricted __le64 [addressable] [assigned] [usertype] eof @@
fs/cifs/smb2ops.c:3966:33: sparse: expected long long [usertype] newsize
fs/cifs/smb2ops.c:3966:33: sparse: got restricted __le64 [addressable] [assigned] [usertype] eof
>> fs/cifs/smb2ops.c:3967:57: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected long long [usertype] new_size @@ got restricted __le64 [addressable] [assigned] [usertype] eof @@
fs/cifs/smb2ops.c:3967:57: sparse: expected long long [usertype] new_size
fs/cifs/smb2ops.c:3967:57: sparse: got restricted __le64 [addressable] [assigned] [usertype] eof
fs/cifs/smb2ops.c:4752:39: sparse: sparse: incompatible types in comparison expression (different type sizes):
fs/cifs/smb2ops.c:4752:39: sparse: unsigned int *
fs/cifs/smb2ops.c:4752:39: sparse: unsigned long *
vim +3965 fs/cifs/smb2ops.c
3932
3933 static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
3934 loff_t off, loff_t len)
3935 {
3936 int rc;
3937 unsigned int xid;
3938 struct inode *inode;
3939 struct cifsFileInfo *cfile = file->private_data;
3940 __le64 eof;
3941
3942 xid = get_xid();
3943
3944 inode = d_inode(cfile->dentry);
3945
3946 if (off >= i_size_read(inode) ||
3947 off + len >= i_size_read(inode)) {
3948 rc = -EINVAL;
3949 goto out;
3950 }
3951
3952 rc = smb2_copychunk_range(xid, cfile, cfile, off + len,
3953 i_size_read(inode) - off - len, off);
3954 if (rc < 0)
3955 goto out;
3956
3957 eof = cpu_to_le64(i_size_read(inode) - len);
3958 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
3959 cfile->fid.volatile_fid, cfile->pid, &eof);
3960 if (rc < 0)
3961 goto out;
3962
3963 rc = 0;
3964
> 3965 netfs_resize_file(inode, eof);
> 3966 truncate_setsize(inode, eof);
> 3967 fscache_resize_cookie(cifs_inode_cookie(inode), eof);
3968 out:
3969 free_xid(xid);
3970 return rc;
3971 }
3972
--
0-DAY CI Kernel Test Service
https://01.org/lkp