From patchwork Fri Apr 21 12:26:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rong Tao X-Patchwork-Id: 13219926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93CF1C7618E for ; Fri, 21 Apr 2023 12:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjDUMeO (ORCPT ); Fri, 21 Apr 2023 08:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbjDUMeO (ORCPT ); Fri, 21 Apr 2023 08:34:14 -0400 X-Greylist: delayed 203 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 21 Apr 2023 05:34:12 PDT Received: from out203-205-251-84.mail.qq.com (unknown [203.205.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 666391AE; Fri, 21 Apr 2023 05:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682080450; bh=E5ogk5vGgouYtZylPwN/B6rVm8IFTTc1usoLg+OEchk=; h=From:To:Cc:Subject:Date; b=p+PSrKxtxClZK+y6YlMT46HV8RUuouo/kBdbdDZfph68+lKCcc+8iyVnCw8YIuLqL eg6Yy3t8KJgXUbTPi/mFhlhvTFc2vf3hnDdlZiih3VwK+hg8WLXyZ2FI12ove4TBY4 s6RFHYNAKjoqUaw3B/v/mKPoJclNDe5XBmxt67C0= Received: from localhost.localdomain ([39.156.73.13]) by newxmesmtplogicsvrsza12-0.qq.com (NewEsmtp) with SMTP id 6A93EC29; Fri, 21 Apr 2023 20:26:41 +0800 X-QQ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aDGhvwKczn2ZnmRdSHB65rkP51ak7aCEWe0HMB9 h23D81Qw== From: Rong Tao To: axboe@kernel.dk Cc: Rong Tao , Pavel Begunkov , io-uring@vger.kernel.org (open list:IO_URING), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] tools/io_uring/io_uring-cp: Fix two compile warings Date: Fri, 21 Apr 2023 20:26:35 +0800 X-OQ-MSGID: <20230421122635.242293-1-rtoax@foxmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Rong Tao Resolve compilation warnings: $ make ... cc -Wall -Wextra -g -D_GNU_SOURCE -o io_uring-cp io_uring-cp.c \ setup.o syscall.o queue.o io_uring-cp.c: In function ‘copy_file’: io_uring-cp.c:158:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare] 158 | if (had_reads != reads) { | ^~ io_uring-cp.c:201:45: warning: comparison of integer expressions of different signedness: ‘__s32’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 201 | } else if (cqe->res != data->iov.iov_len) { | ^~ Signed-off-by: Rong Tao --- tools/io_uring/io_uring-cp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/io_uring/io_uring-cp.c b/tools/io_uring/io_uring-cp.c index d9bd6f5f8f46..8a0ecaf78bda 100644 --- a/tools/io_uring/io_uring-cp.c +++ b/tools/io_uring/io_uring-cp.c @@ -131,7 +131,8 @@ static int copy_file(struct io_uring *ring, off_t insize) writes = reads = offset = 0; while (insize || write_left) { - int had_reads, got_comp; + unsigned long had_reads; + int got_comp; /* * Queue up as many reads as we can @@ -198,7 +199,7 @@ static int copy_file(struct io_uring *ring, off_t insize) fprintf(stderr, "cqe failed: %s\n", strerror(-cqe->res)); return 1; - } else if (cqe->res != data->iov.iov_len) { + } else if ((size_t)cqe->res != data->iov.iov_len) { /* Short read/write, adjust and requeue */ data->iov.iov_base += cqe->res; data->iov.iov_len -= cqe->res;