Re: [PATCH/rfc] NFS: introduce NFS namespaces.

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

 



Hi NeilBrown,

url:    https://github.com/0day-ci/linux/commits/NeilBrown/NFS-introduce-NFS-namespaces/20210625-093359
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: x86_64-randconfig-m001-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

New smatch warnings:
fs/nfs/nfs4proc.c:6270 nfs4_init_uniform_client_string() error: we previously assumed 'clp->cl_namespace' could be null (see line 6247)

Old smatch warnings:
fs/nfs/nfs4proc.c:1382 nfs4_opendata_alloc() error: we previously assumed 'c' could be null (see line 1350)

vim +6270 fs/nfs/nfs4proc.c

873e385116b2cc Jeff Layton     2015-06-09  6234  static int
873e385116b2cc Jeff Layton     2015-06-09  6235  nfs4_init_uniform_client_string(struct nfs_client *clp)
873e385116b2cc Jeff Layton     2015-06-09  6236  {
1aee551334cda1 Trond Myklebust 2020-10-07  6237  	char buf[NFS4_CLIENT_ID_UNIQ_LEN];
1aee551334cda1 Trond Myklebust 2020-10-07  6238  	size_t buflen;
873e385116b2cc Jeff Layton     2015-06-09  6239  	size_t len;
873e385116b2cc Jeff Layton     2015-06-09  6240  	char *str;
ceb3a16c070c40 Trond Myklebust 2015-01-03  6241  
ceb3a16c070c40 Trond Myklebust 2015-01-03  6242  	if (clp->cl_owner_id != NULL)
873e385116b2cc Jeff Layton     2015-06-09  6243  		return 0;
6f2ea7f2a3ff3c Chuck Lever     2012-09-14  6244  
873e385116b2cc Jeff Layton     2015-06-09  6245  	len = 10 + 10 + 1 + 10 + 1 +
873e385116b2cc Jeff Layton     2015-06-09  6246  		strlen(clp->cl_rpcclient->cl_nodename) + 1;
0575ca34891617 NeilBrown       2021-06-25 @6247  	if (clp->cl_namespace)
                                                        ^^^^^^^^^^^^^^^^^^^^^^
Checks for NULL

0575ca34891617 NeilBrown       2021-06-25  6248  		len += strlen(clp->cl_namespace) + 1;
873e385116b2cc Jeff Layton     2015-06-09  6249  
39d43d164127da Trond Myklebust 2020-10-07  6250  	buflen = nfs4_get_uniquifier(clp, buf, sizeof(buf));
1aee551334cda1 Trond Myklebust 2020-10-07  6251  	if (buflen)
1aee551334cda1 Trond Myklebust 2020-10-07  6252  		len += buflen + 1;
1aee551334cda1 Trond Myklebust 2020-10-07  6253  
873e385116b2cc Jeff Layton     2015-06-09  6254  	if (len > NFS4_OPAQUE_LIMIT + 1)
873e385116b2cc Jeff Layton     2015-06-09  6255  		return -EINVAL;
873e385116b2cc Jeff Layton     2015-06-09  6256  
873e385116b2cc Jeff Layton     2015-06-09  6257  	/*
873e385116b2cc Jeff Layton     2015-06-09  6258  	 * Since this string is allocated at mount time, and held until the
873e385116b2cc Jeff Layton     2015-06-09  6259  	 * nfs_client is destroyed, we can use GFP_KERNEL here w/o worrying
873e385116b2cc Jeff Layton     2015-06-09  6260  	 * about a memory-reclaim deadlock.
873e385116b2cc Jeff Layton     2015-06-09  6261  	 */
873e385116b2cc Jeff Layton     2015-06-09  6262  	str = kmalloc(len, GFP_KERNEL);
873e385116b2cc Jeff Layton     2015-06-09  6263  	if (!str)
873e385116b2cc Jeff Layton     2015-06-09  6264  		return -ENOMEM;
873e385116b2cc Jeff Layton     2015-06-09  6265  
1aee551334cda1 Trond Myklebust 2020-10-07  6266  	if (buflen)
0575ca34891617 NeilBrown       2021-06-25  6267  		scnprintf(str, len, "Linux NFSv%u.%u %s/%s%s%s",
1aee551334cda1 Trond Myklebust 2020-10-07  6268  			  clp->rpc_ops->version, clp->cl_minorversion,
0575ca34891617 NeilBrown       2021-06-25  6269  			  buf, clp->cl_rpcclient->cl_nodename,
0575ca34891617 NeilBrown       2021-06-25 @6270  			  *clp->cl_namespace ? "/" : "",
                                                                          ^^^^^^^^^^^^^^^^^^
Unchecked dereference

0575ca34891617 NeilBrown       2021-06-25  6271  			  clp->cl_namespace);
1aee551334cda1 Trond Myklebust 2020-10-07  6272  	else
0575ca34891617 NeilBrown       2021-06-25  6273  		scnprintf(str, len, "Linux NFSv%u.%u %s%s%s",
e984a55a7418f7 Chuck Lever     2012-09-14  6274  			  clp->rpc_ops->version, clp->cl_minorversion,
0575ca34891617 NeilBrown       2021-06-25  6275  			  clp->cl_rpcclient->cl_nodename,
0575ca34891617 NeilBrown       2021-06-25  6276  			  *clp->cl_namespace ? "/" : "",
                                                                          ^^^^^^^^^^^^^^^^^^
Unchecked dereference

0575ca34891617 NeilBrown       2021-06-25  6277  			  clp->cl_namespace);
873e385116b2cc Jeff Layton     2015-06-09  6278  	clp->cl_owner_id = str;
873e385116b2cc Jeff Layton     2015-06-09  6279  	return 0;
e984a55a7418f7 Chuck Lever     2012-09-14  6280  }

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




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux