* [PATCH 3/3] nfsd/callback: Drop an useless data copy when comparing sessionid
@ 2017-02-05 1:57 Kinglong Mee
2017-02-17 20:25 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Kinglong Mee @ 2017-02-05 1:57 UTC (permalink / raw)
To: J. Bruce Fields, linux-nfs; +Cc: Kinglong Mee
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fs/nfsd/nfs4callback.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index ea74149..0274db6 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -397,13 +397,10 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr,
struct nfsd4_callback *cb)
{
struct nfsd4_session *session = cb->cb_clp->cl_cb_session;
- struct nfs4_sessionid id;
- int status;
+ int status = -ESERVERFAULT;
__be32 *p;
u32 dummy;
- status = -ESERVERFAULT;
-
/*
* If the server returns different values for sessionID, slotID or
* sequence number, the server is looney tunes.
@@ -411,9 +408,8 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr,
p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4 + 4 + 4);
if (unlikely(p == NULL))
goto out_overflow;
- memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
- if (memcmp(id.data, session->se_sessionid.data,
- NFS4_MAX_SESSIONID_LEN) != 0) {
+
+ if (memcmp(p, session->se_sessionid.data, NFS4_MAX_SESSIONID_LEN)) {
dprintk("NFS: %s Invalid session id\n", __func__);
goto out;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 3/3] nfsd/callback: Drop an useless data copy when comparing sessionid
2017-02-05 1:57 [PATCH 3/3] nfsd/callback: Drop an useless data copy when comparing sessionid Kinglong Mee
@ 2017-02-17 20:25 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2017-02-17 20:25 UTC (permalink / raw)
To: Kinglong Mee; +Cc: linux-nfs
These three look fine, thanks; applying.--b.
On Sun, Feb 05, 2017 at 09:57:48AM +0800, Kinglong Mee wrote:
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
> fs/nfsd/nfs4callback.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
> index ea74149..0274db6 100644
> --- a/fs/nfsd/nfs4callback.c
> +++ b/fs/nfsd/nfs4callback.c
> @@ -397,13 +397,10 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr,
> struct nfsd4_callback *cb)
> {
> struct nfsd4_session *session = cb->cb_clp->cl_cb_session;
> - struct nfs4_sessionid id;
> - int status;
> + int status = -ESERVERFAULT;
> __be32 *p;
> u32 dummy;
>
> - status = -ESERVERFAULT;
> -
> /*
> * If the server returns different values for sessionID, slotID or
> * sequence number, the server is looney tunes.
> @@ -411,9 +408,8 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr,
> p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4 + 4 + 4);
> if (unlikely(p == NULL))
> goto out_overflow;
> - memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
> - if (memcmp(id.data, session->se_sessionid.data,
> - NFS4_MAX_SESSIONID_LEN) != 0) {
> +
> + if (memcmp(p, session->se_sessionid.data, NFS4_MAX_SESSIONID_LEN)) {
> dprintk("NFS: %s Invalid session id\n", __func__);
> goto out;
> }
> --
> 2.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-17 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-05 1:57 [PATCH 3/3] nfsd/callback: Drop an useless data copy when comparing sessionid Kinglong Mee
2017-02-17 20:25 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).