Commit:     d45273ed6f4613e81701c3e896d9db200c288fff
Parent:     6a0ed1de8ecee0cde21ea667891a03f6c84ecd66
Author:     Chuck Lever <[EMAIL PROTECTED]>
AuthorDate: Fri Oct 26 13:32:45 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 02:05:46 2008 -0500

    NFS: Clean up address comparison in __nfs_find_client()
    The address comparison in the __nfs_find_client() function is deceptive.
    It uses a memcmp() to check a pair of u32 fields for equality.  Not only is
    this inefficient, but usually memcmp() is used for comparing two *whole*
    sockaddr_in's (which includes comparisons of the address family and port
    number), so it's easy to mistake the comparison here for a whole sockaddr
    comparison, which it isn't.
    So for clarity and efficiency, we replace the memcmp() with a simple test
    for equality between the two s_addr fields.  This should have no
    behavioral effect.
    Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
 fs/nfs/client.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c3740f5..8b5f9b9 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -220,8 +220,7 @@ static struct nfs_client *__nfs_find_client(const struct 
sockaddr_in *addr, int
                if (clp->cl_nfsversion != nfsversion)
-               if (memcmp(&clp->cl_addr.sin_addr, &addr->sin_addr,
-                          sizeof(clp->cl_addr.sin_addr)) != 0)
+               if (clp->cl_addr.sin_addr.s_addr != addr->sin_addr.s_addr)
                if (!match_port || clp->cl_addr.sin_port == addr->sin_port)
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to