diff options
author | Chengguang Xu <cgxu519@mykernel.net> | 2020-06-17 09:09:39 +0800 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2020-09-21 10:21:08 -0400 |
commit | 82c596ebaa104f994d25256523ae2f9047323fe7 (patch) | |
tree | 18cc37b47fd88868840cadc91b84111ad80bc820 /fs/nfs/nfs4proc.c | |
parent | 48bb6ec17cde09122931438add817a69a91c3ab6 (diff) |
nfs4: strengthen error check to avoid unexpected result
The variable error is ssize_t, which is signed and will
cast to unsigned when comapre with variable size, so add
a check to avoid unexpected result in case of negative
value of error.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1d23dc640208..aca52e52538f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -7440,7 +7440,7 @@ nfs4_listxattr_nfs4_label(struct inode *inode, char *list, size_t list_len) if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) { len = security_inode_listsecurity(inode, list, list_len); - if (list_len && len > list_len) + if (len >= 0 && list_len && len > list_len) return -ERANGE; } return len; |