fs/nfsd/vfs.c:2252:13: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Wed Sep 23 2020 - 10:48:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 805c6d3c19210c90c109107d189744e960eae025
commit: 32119446bb65da559eb6f05236086fe449d2a024 nfsd: define xattr functions to call into their vfs counterparts
date: 2 months ago
config: m68k-randconfig-s032-20200923 (attached as .config)
compiler: m68k-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.2-201-g24bdaac6-dirty
git checkout 32119446bb65da559eb6f05236086fe449d2a024
# 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=m68k

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


sparse warnings: (new ones prefixed by >>)

>> fs/nfsd/vfs.c:2252:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected int err @@ got restricted __be32 @@
>> fs/nfsd/vfs.c:2252:13: sparse: expected int err
>> fs/nfsd/vfs.c:2252:13: sparse: got restricted __be32
>> fs/nfsd/vfs.c:2254:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got int err @@
>> fs/nfsd/vfs.c:2254:24: sparse: expected restricted __be32
>> fs/nfsd/vfs.c:2254:24: sparse: got int err
fs/nfsd/vfs.c:2276:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected int err @@ got restricted __be32 @@
fs/nfsd/vfs.c:2276:13: sparse: expected int err
fs/nfsd/vfs.c:2276:13: sparse: got restricted __be32
fs/nfsd/vfs.c:2278:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got int err @@
fs/nfsd/vfs.c:2278:24: sparse: expected restricted __be32
fs/nfsd/vfs.c:2278:24: sparse: got int err

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=32119446bb65da559eb6f05236086fe449d2a024
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 32119446bb65da559eb6f05236086fe449d2a024
vim +2252 fs/nfsd/vfs.c

2238
2239 /*
2240 * Removexattr and setxattr need to call fh_lock to both lock the inode
2241 * and set the change attribute. Since the top-level vfs_removexattr
2242 * and vfs_setxattr calls already do their own inode_lock calls, call
2243 * the _locked variant. Pass in a NULL pointer for delegated_inode,
2244 * and let the client deal with NFS4ERR_DELAY (same as with e.g.
2245 * setattr and remove).
2246 */
2247 __be32
2248 nfsd_removexattr(struct svc_rqst *rqstp, struct svc_fh *fhp, char *name)
2249 {
2250 int err, ret;
2251
> 2252 err = fh_verify(rqstp, fhp, 0, NFSD_MAY_WRITE);
2253 if (err)
> 2254 return err;
2255
2256 ret = fh_want_write(fhp);
2257 if (ret)
2258 return nfserrno(ret);
2259
2260 fh_lock(fhp);
2261
2262 ret = __vfs_removexattr_locked(fhp->fh_dentry, name, NULL);
2263
2264 fh_unlock(fhp);
2265 fh_drop_write(fhp);
2266
2267 return nfsd_xattr_errno(ret);
2268 }
2269

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

Attachment: .config.gz
Description: application/gzip