]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: fix signed comparison problem in copy_file_range
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Jun 2018 00:38:54 +0000 (19:38 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 1 Jun 2018 00:38:54 +0000 (19:38 -0500)
cvtnum() returns a signed long long, so the type of 'len' should be a
signed type so that a user entering a negative length doesn't produce
some huge positive integer.  The negative len check demands it anyway.

Coverity-id: 1435895
Fixes: 25b4549 ("xfs_io: Make copy_range arguments understand *iB values")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/copy_file_range.c

index ebd1ec764013931f05a62a038454536e5338e8ab..4d0770ef2a54742b915cf638abadb26c79750c69 100644 (file)
@@ -91,7 +91,7 @@ copy_range_f(int argc, char **argv)
 {
        long long src = 0;
        long long dst = 0;
-       size_t len = 0;
+       long long len = 0;
        int opt;
        int ret;
        int fd;