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>
This commit is contained in:
committed by
Anna Schumaker
parent
48bb6ec17c
commit
82c596ebaa
@@ -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)) {
|
if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) {
|
||||||
len = security_inode_listsecurity(inode, list, list_len);
|
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 -ERANGE;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
|
|||||||
Reference in New Issue
Block a user