[cel:nfsd-testing 199/222] fs/nfsd/nfs4proc.c:224:47: sparse: sparse: incorrect type in initializer (different base types)

kernel test robot <[email protected]> Fri, 31 Jul 2026 09:12:08 +0800
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux nfsd-testing
head:   67be65963a6470b667125cc648b56161ed3dfdce
commit: 5143cf703ab5386a0f67df40998acf5a882eabf2 [199/222] nfsd: separate out VFS-specific code from nfsd4_create_file()
config: m68k-randconfig-r122-20260730 (https://download.01.org/0day-ci/archive/20260731/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.4.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260731/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
   fs/nfsd/nfs4proc.c:179:24: sparse: sparse: incorrect type in return expression (different base types) @@     expected restricted __be32 @@     got int @@
   fs/nfsd/nfs4proc.c:179:24: sparse:     expected restricted __be32
   fs/nfsd/nfs4proc.c:179:24: sparse:     got int
   fs/nfsd/nfs4proc.c:181:24: sparse: sparse: incorrect type in return expression (different base types) @@     expected restricted __be32 @@     got int @@
   fs/nfsd/nfs4proc.c:181:24: sparse:     expected restricted __be32
   fs/nfsd/nfs4proc.c:181:24: sparse:     got int
   fs/nfsd/nfs4proc.c:182:16: sparse: sparse: incorrect type in return expression (different base types) @@     expected restricted __be32 @@     got int @@
   fs/nfsd/nfs4proc.c:182:16: sparse:     expected restricted __be32
   fs/nfsd/nfs4proc.c:182:16: sparse:     got int
>> fs/nfsd/nfs4proc.c:224:47: sparse: sparse: incorrect type in initializer (different base types) @@     expected int err @@     got restricted __be32 @@
   fs/nfsd/nfs4proc.c:224:47: sparse:     expected int err
   fs/nfsd/nfs4proc.c:224:47: sparse:     got restricted __be32
   fs/nfsd/nfs4proc.c:541:47: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected int errno @@     got restricted __be32 @@
   fs/nfsd/nfs4proc.c:541:47: sparse:     expected int errno
   fs/nfsd/nfs4proc.c:541:47: sparse:     got restricted __be32

vim +224 fs/nfsd/nfs4proc.c

   198	
   199	static struct file *do_lookup_open(struct path *parent,
   200					   struct qstr *name,
   201					   unsigned int oflags,
   202					   umode_t mode)
   203	{
   204		struct file *filp = NULL;
   205		struct path path;
   206		struct dentry *child;
   207		int want_write_err = 0;
   208	
   209		want_write_err = mnt_want_write(parent->mnt);
   210	
   211		child = start_creating(&nop_mnt_idmap, parent->dentry, name);
   212		if (IS_ERR(child)) {
   213			filp = ERR_CAST(child);
   214			goto out;
   215		}
   216		path.mnt = parent->mnt;
   217		path.dentry = child;
   218	
   219		if (d_really_is_positive(child)) {
   220			/*
   221			 * open the file so that we consistently have a valid
   222			 * op_filp and consequently a valid ->f_path.dentry.
   223			 */
 > 224			int err = nfsd_check_obj_isreg(child);
   225	
   226			if (err)
   227				filp = ERR_PTR(err);
   228			else
   229				filp = dentry_open(&path, oflags, current_cred());
   230		} else if (!(oflags & O_CREAT)) {
   231			filp = ERR_PTR(-ENOENT);
   232		} else if (want_write_err) {
   233			filp = ERR_PTR(want_write_err);
   234		} else {
   235			filp = dentry_create(&path, oflags, mode, current_cred());
   236			child = path.dentry;
   237		}
   238		end_creating(child);
   239	out:
   240		if (!want_write_err)
   241			mnt_drop_write(parent->mnt);
   242		return filp;
   243	}
   244	

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