Commit e739b120 authored by Olga Kornievskaia's avatar Olga Kornievskaia Committed by Chuck Lever
Browse files

NFSv4.2: fix copy stateid copying for the async copy



This patch fixes Dan Carpenter's report that the static checker
found a problem where memcpy() was copying into too small of a buffer.

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: e0639dc5 ("NFSD introduce async copy feature")
Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarDai Ngo <dai.ngo@oracle.com>
parent c0a744dc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1541,8 +1541,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
		if (!nfs4_init_copy_state(nn, copy))
			goto out_err;
		refcount_set(&async_copy->refcount, 1);
		memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
			sizeof(copy->cp_stateid));
		memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid.stid,
			sizeof(copy->cp_res.cb_stateid));
		dup_copy_fields(copy, async_copy);
		async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
				async_copy, "%s", "copy thread");