diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-09-21 00:53:46 +0300 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-10-02 01:51:30 +0300 |
commit | cdb2e53fd6dc715c5b45d0967fcb6dc574cb28f8 (patch) | |
tree | 79c51cee65b7d0aca3c20d90c80e5cf474add959 /fs/nfs/nfs4idmap.c | |
parent | 35c036ef4a722e953e17884f4f4325f78eeab475 (diff) | |
download | linux-cdb2e53fd6dc715c5b45d0967fcb6dc574cb28f8.tar.xz |
NFS: Cleanup error handling in nfs_idmap_request_key()
nfs_idmap_get_desc() can't actually return zero. But if it did then
we would return ERR_PTR(0) which is NULL and the caller,
nfs_idmap_get_key(), doesn't expect that so it leads to a NULL pointer
dereference.
I've cleaned this up by changing the "<=" to "<" so it's more clear that
we don't return ERR_PTR(0).
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4idmap.c')
-rw-r--r-- | fs/nfs/nfs4idmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c index dd5d27da8c0c..30426c1a1bbd 100644 --- a/fs/nfs/nfs4idmap.c +++ b/fs/nfs/nfs4idmap.c @@ -274,7 +274,7 @@ static struct key *nfs_idmap_request_key(const char *name, size_t namelen, ssize_t ret; ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc); - if (ret <= 0) + if (ret < 0) return ERR_PTR(ret); rkey = request_key(&key_type_id_resolver, desc, ""); |