If copy_src_filesize returns an error (-1) we should return that error, and not pass it to copy_file_range_cmd(). Addresses-Coverity-ID: 1431684 ("Improper use of negative value") Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- diff --git a/io/copy_file_range.c b/io/copy_file_range.c index 4e2969c..bc891c9 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -121,6 +121,10 @@ copy_range_f(int argc, char **argv) if (src == 0 && dst == 0 && len == 0) { len = copy_src_filesize(fd); + if (len < 0) { + close(fd); + return 0; + } copy_dst_truncate(); }