io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring@vger.kernel.org, Ammar Faizi <ammarfaizi2@gmail.com>
Subject: [PATCH liburing 2/2] test/file-verify: fix 32-bit build -Werror=shift-count-overflow
Date: Thu, 16 Sep 2021 11:27:31 +0700	[thread overview]
Message-ID: <20210916042731.210100-3-ammarfaizi2@gmail.com> (raw)
In-Reply-To: <20210916042731.210100-1-ammarfaizi2@gmail.com>

`off_t` may not always be 64-bit in size.
```
  file-verify.c: In function 'test':
  file-verify.c:193:26: error: left shift count >= width of type [-Werror=shift-count-overflow]
      sqe->user_data = (off << 32) | i;
                            ^
  cc1: all warnings being treated as errors
  Makefile:164: recipe for target 'file-verify' failed
  make[1]: *** [file-verify] Error 1
  make[1]: Leaving directory '/root/liburing/test'
  Makefile:12: recipe for target 'all' failed
  make: *** [all] Error 2
```
Fix this by using (uint64_t) cast.

Signed-off-by: Ammar Faizi <ammarfaizi2@gmail.com>
---
 test/file-verify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/file-verify.c b/test/file-verify.c
index ffedd87..cd6c4de 100644
--- a/test/file-verify.c
+++ b/test/file-verify.c
@@ -190,7 +190,7 @@ static int test(struct io_uring *ring, const char *fname, int buffered,
 				else
 					io_uring_prep_read(sqe, fd, buf[i], this, off);
 			}
-			sqe->user_data = (off << 32) | i;
+			sqe->user_data = ((uint64_t)off << 32) | i;
 			off += this;
 			left -= this;
 			pending++;
-- 
2.30.2


  parent reply	other threads:[~2021-09-16  4:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16  4:27 [PATCH liburing 0/2] Update .gitignore and fix 32-bit build Ammar Faizi
2021-09-16  4:27 ` [PATCH liburing 1/2] .gitignore: add `test/file-verify` Ammar Faizi
2021-09-16  4:31   ` [PATCH liburing v2 " Ammar Faizi
2021-09-16  4:27 ` Ammar Faizi [this message]
2021-09-16 15:17 ` [PATCH liburing 0/2] Update .gitignore and fix 32-bit build Jens Axboe

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 \
    --in-reply-to=20210916042731.210100-3-ammarfaizi2@gmail.com \
    --to=ammarfaizi2@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).