Skip to content

Commit 8274338

Browse files
kinglongmeeJ. Bruce Fields
authored andcommitted
nfsd/callback: Drop a useless data copy when comparing sessionid
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent e86a40b commit 8274338

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,23 +397,19 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr,
397397
struct nfsd4_callback *cb)
398398
{
399399
struct nfsd4_session *session = cb->cb_clp->cl_cb_session;
400-
struct nfs4_sessionid id;
401-
int status;
400+
int status = -ESERVERFAULT;
402401
__be32 *p;
403402
u32 dummy;
404403

405-
status = -ESERVERFAULT;
406-
407404
/*
408405
* If the server returns different values for sessionID, slotID or
409406
* sequence number, the server is looney tunes.
410407
*/
411408
p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4 + 4 + 4);
412409
if (unlikely(p == NULL))
413410
goto out_overflow;
414-
memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
415-
if (memcmp(id.data, session->se_sessionid.data,
416-
NFS4_MAX_SESSIONID_LEN) != 0) {
411+
412+
if (memcmp(p, session->se_sessionid.data, NFS4_MAX_SESSIONID_LEN)) {
417413
dprintk("NFS: %s Invalid session id\n", __func__);
418414
goto out;
419415
}

0 commit comments

Comments
 (0)