Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2178219rwr; Fri, 21 Apr 2023 05:37:44 -0700 (PDT) X-Google-Smtp-Source: AKy350ZmYdY8A23w6osGeR2uFaqvmhkavJHyLUaHfAfeadOzxPCV1ILFnYgD3430erJXlKe7hVcp X-Received: by 2002:a17:902:f690:b0:1a6:e00b:c3e5 with SMTP id l16-20020a170902f69000b001a6e00bc3e5mr5876937plg.4.1682080663903; Fri, 21 Apr 2023 05:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682080663; cv=none; d=google.com; s=arc-20160816; b=W4rnfM1gqyjIxA1m8djYtFTjMbLCMIdrWy86yCNNzu5t7OSxeRxT9HawF62ZxX1OKP n+IMlxCV11nfOs23WDIkzKArnYrXUifANdiIEf3bcgus+C0XVUpRmyt1Q+GJbhYkzzj/ olLuZZp24fjPlDWrNnJMil+2qY1lbRwirz6OJ3sYPvWfNw5lNHBP67Sukcc9RXBZdVCA ExTOwE4sUon/pVKW73/M5fLFcEYEuvyna/Qlj5a+E28V5Ar/kFbV3cttLCRFZoPA6rXG sJ3kXjsFG/1q4GORpTO+qc9eTENfUViGvbo2UoJMzjIkpuvU6+85oY+AxItDOSL8vndM phNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :subject:cc:to:from:message-id:dkim-signature; bh=E5ogk5vGgouYtZylPwN/B6rVm8IFTTc1usoLg+OEchk=; b=SiTdE/Zf1z37Iv4muGWZFf4MFPNyCtgkyWyCLl3bHBxr31h9qPS5D2+XAi742YeADG 3+Y+yer/CfKdNkvvqDfY2TNpeQuqk/kY3XaqvEozwxh+sWlKV3ZkcwcJXWZzgKbklje1 24kRU2PFinVqa2rUFu0mRni41HkcveMHDs6CpGYKPea1CP9kGzbWHVVZAbyWZPBwCnH3 H0Fq79EnlxBg01ZhoPJdCXl+phEV9TuhIKLuZPpIiJaRuKbu6UjIV9xqD74s/7zuoygM 8IKq8kYk6h6USGp2KxQoBdhu+lkUsIWwFO2BshZWNxITCrnpJDVzZQoez/9OlVPvvaby SVOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=p+PSrKxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p24-20020a170903249800b001a68bbbaaa5si4235149plw.593.2023.04.21.05.37.29; Fri, 21 Apr 2023 05:37:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=p+PSrKxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbjDUMeP (ORCPT + 99 others); Fri, 21 Apr 2023 08:34:15 -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-mid: xmsmtpt1682080001tyjygpl3a Message-ID: X-QQ-XMAILINFO: Mee1Vp/QiDAWXMQ6xzehAwpwdutSjxTnc1irddOHDbiCsu/oUI2GYLkOoNwLet i7HyvtvvuTcleQgwXv4AnQzPlLQxl14muN4BkkjsRw6OF1HZJUWTGB6IyT6dDOhQaAzzUCWUh5SB oYLAgZtiQABcu7XR/O/Sq40hOPiGeBUstVIuvEHX9VzsRWZ9jrvG8V8TO8NSsml28tQOVehylz+j qVyfUge0kfb+7KZzxHnVn6JdzjpW5Fvpq8C8cIqJYQVTpQtSf43HuAlrdMEL/OpBjTrUVXWjoDG1 AfjFf7tTGZbZic3A6PxL2dSCSm94lDI2DP5zb8ooox64SbdCgA5vMEmnRseZEy5NrbkWhJ+VTAnx e1NNjFyhMRgObLpv45m97RKqXqgXU95n0QxdaXzGCQ/jrLJvG1rMSIoAd3HQSVlAHV9Xqd0+Tp2a msaiPfIBsfcOptxQk8pz/ZP2/BjaRmq5IIjhuoyEkIH+el+lP1mtEeVdLrpCmh3mSxAODEynHMvT RLYsDNMHiGSepaDhtHKRzYz6a2aUJtO7SZMB/hzMsBZt+hbx3sAGyUdrjwWOQTIEecjZFxOdM2nt EgcN905INWq/gCmb9/lNYHGdpn5t/VA3C5S1c3Hb1+/tQRgivPW6/Hv5HLi03kM3VvXD/ikxokZm wyGZw4PfQ8UHlgHRdb58jwZOMOwi9xTzi8uOU+VvuMTbEDGCT9lNgHr/k8TGA1Vqz7BsJz33KaYe a0DuIOBPp7lBdLgc9yeYi3QL6PiOEZzUCl9Sj8jhY3n5x2JPf7Y7QE2PrWvJXDI9qI3JF7SGZcoo M1i6N1UGoj+4+hrfmeP+9gS5Ai4oJ7peq/mW05y5bmFm0HdVLC1FBYX6UZpQP0ZRAl7h4VdZhn06 qnk8SgCWE2In/lH/DyOzXC/QRzQOCVjT4o0KhEyJxB659GJN2schXfFD3mVp8rb5z+4XXxNr/l0m 91mfS0pI31ggS/3IwzTen/poBuA6X9/iuH+mHaDGhvwKczn2ZnmRdSHB65rkP51ak7aCEWe0HMB9 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, HELO_DYNAMIC_IPADDR,RDNS_DYNAMIC,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; -- 2.39.1