[PATCH liburing 2/2] test/file-verify: fix 32-bit build -Werror=shift-count-overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



`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@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux