NFS: Fabricate fscache server index key correctly
authorDavid Howells <dhowells@redhat.com>
Thu, 25 Sep 2014 13:34:41 +0000 (14:34 +0100)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 26 Sep 2014 01:25:18 +0000 (21:25 -0400)
When fabricating a server index key for fscache, we should clear the index key
buffer before starting to fill it in, not in the middle.

Reported-by: James Pearson <james-p@moving-picture.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/fscache-index.c

index 7cf2c4699b08faf04e7db63f9e92300348c26843..777b055063f68a83e3655bd6cbeac8aabf1fba70 100644 (file)
@@ -74,11 +74,10 @@ static uint16_t nfs_server_get_key(const void *cookie_netfs_data,
        struct nfs_server_key *key = buffer;
        uint16_t len = sizeof(struct nfs_server_key);
 
+       memset(key, 0, len);
        key->nfsversion = clp->rpc_ops->version;
        key->family = clp->cl_addr.ss_family;
 
-       memset(key, 0, len);
-
        switch (clp->cl_addr.ss_family) {
        case AF_INET:
                key->port = sin->sin_port;