From patchwork Mon Dec 3 00:20:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 10708461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA6C913BF for ; Mon, 3 Dec 2018 00:20:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D650C2A4FC for ; Mon, 3 Dec 2018 00:20:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C77C52A680; Mon, 3 Dec 2018 00:20:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BC912A67E for ; Mon, 3 Dec 2018 00:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725786AbeLCAUn (ORCPT ); Sun, 2 Dec 2018 19:20:43 -0500 Received: from ipmail01.adl2.internode.on.net ([150.101.137.133]:49545 "EHLO ipmail01.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbeLCAUm (ORCPT ); Sun, 2 Dec 2018 19:20:42 -0500 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail01.adl2.internode.on.net with ESMTP; 03 Dec 2018 10:50:37 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1gTbyW-0002tt-Td for linux-xfs@vger.kernel.org; Mon, 03 Dec 2018 11:20:37 +1100 Date: Mon, 3 Dec 2018 11:20:36 +1100 From: Dave Chinner To: linux-xfs@vger.kernel.org Subject: [PATCH 3/2] xfs_io: copy_file_range length is a size_t Message-ID: <20181203002036.GB6311@dastard> References: <20181202205343.7104-1-david@fromorbit.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181202205343.7104-1-david@fromorbit.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Chinner copy_file_range() takes a size_t as it's length, not a "long long". Therefore we need to be able to pass sizes larger than 8EB to it to be able to test the interface fully and that requires copy_range to accept all values except an explicit error value of "-1LL". Signed-off-by: Dave Chinner Reviewed-by: Jan Tulak Reviewed-by: Darrick J. Wong --- io/copy_file_range.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/io/copy_file_range.c b/io/copy_file_range.c index f118a3bfd506..4e2969c9ca47 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -34,7 +34,7 @@ copy_range_help(void) * glibc buffered copy fallback. */ static loff_t -copy_file_range_cmd(int fd, long long *src, long long *dst, long long len) +copy_file_range_cmd(int fd, long long *src, long long *dst, size_t len) { loff_t ret; @@ -78,7 +78,7 @@ copy_range_f(int argc, char **argv) { long long src = 0; long long dst = 0; - long long len = 0; + size_t len = 0; int opt; int ret; int fd; @@ -104,7 +104,7 @@ copy_range_f(int argc, char **argv) break; case 'l': len = cvtnum(fsblocksize, fssectsize, optarg); - if (len < 0) { + if (len == -1LL) { printf(_("invalid length -- %s\n"), optarg); return 0; }