[bug report] NFSD introduce async copy feature

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

 



Hello Olga Kornievskaia,

This is a semi-automatic email about new static checker warnings.

The patch e0639dc5805a: "NFSD introduce async copy feature" from Jul 
20, 2018, leads to the following Smatch complaint:

    fs/nfsd/nfs4proc.c:1555 nfsd4_copy()
     error: we previously assumed 'async_copy' could be null (see line 1529)

fs/nfsd/nfs4proc.c
  1528			async_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL);
  1529			if (!async_copy)
  1530				goto out_err;
                                ^^^^^^^^^^^^
There are a couple error paths where async_copy is NULL.

  1531			if (!nfs4_init_copy_state(nn, copy))
  1532				goto out_err;
  1533			refcount_set(&async_copy->refcount, 1);
  1534			memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
  1535				sizeof(copy->cp_stateid));
  1536			status = dup_copy_fields(copy, async_copy);
  1537			if (status)
  1538				goto out_err;
  1539			async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
  1540					async_copy, "%s", "copy thread");
  1541			if (IS_ERR(async_copy->copy_task))
  1542				goto out_err;
  1543			spin_lock(&async_copy->cp_clp->async_lock);
  1544			list_add(&async_copy->copies,
  1545					&async_copy->cp_clp->async_copies);
  1546			spin_unlock(&async_copy->cp_clp->async_lock);
  1547			wake_up_process(async_copy->copy_task);
  1548			status = nfs_ok;
  1549		} else {
  1550			status = nfsd4_do_copy(copy, 1);
  1551		}
  1552	out:
  1553		return status;
  1554	out_err:
  1555		cleanup_async_copy(async_copy);
                                   ^^^^^^^^^^
Dereferenced inside the function.

  1556		status = nfserrno(-ENOMEM);
  1557		if (!copy->cp_intra)

regards,
dan carpenter



[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