From: Darrick J. Wong Date: Fri, 1 Jun 2018 00:38:54 +0000 (-0500) Subject: xfs_io: fix signed comparison problem in copy_file_range X-Git-Tag: v4.17.0-rc1~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb1b013b265e0e4f13b7a2d2a06dbd39091cc05f;p=thirdparty%2Fxfsprogs-dev.git xfs_io: fix signed comparison problem in copy_file_range 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 Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/io/copy_file_range.c b/io/copy_file_range.c index ebd1ec764..4d0770ef2 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -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;