From: Xiongfeng Wang <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>,
<[email protected]>
Subject: [PATCH] tools/io_uring/io_uring-cp: fix compile warning in copy_file()
Date: Fri, 11 Nov 2022 11:56:02 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
Build tools/io_uring emits the following warnings.
io_uring-cp.c: In function ‘copy_file’:
io_uring-cp.c:158:17: 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:24: 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) {
| ^~
Change the type of 'had_reads' to 'unsigned long' to fix the first
compile warning. For the second warning, cast 'cqe->res' to
'__kernel_size_t' before comparison to fix it.
Signed-off-by: Xiongfeng Wang <[email protected]>
---
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..643c226f91ac 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 ((__kernel_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.20.1
reply other threads:[~2022-11-11 3:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox