| From 286bed8bc95fbc7d8a1d00b1861037bc215948ee Mon Sep 17 00:00:00 2001 |
| From: Jens Axboe <axboe@kernel.dk> |
| Date: Fri, 26 Aug 2022 07:52:54 -0600 |
| Subject: [PATCH] t/io_uring: fix 64-bit cast on 32-bit archs |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| gcc complains that: |
| |
| t/io_uring.c: In function ‘init_io_pt’: |
| t/io_uring.c:618:52: error: left shift count >= width of type [-Werror=shift-count-overflow] |
| 618 | sqe->user_data |= ((unsigned long)s->clock_index << 32); |
| | ^~ |
| |
| we're shifting more than the size of the type. Cast to a 64-bit value |
| so that it'll work on 32-bit as well. |
| |
| Fixes: 7d04588a7663 ("t/io_uring: add support for async-passthru") |
| Signed-off-by: Jens Axboe <axboe@kernel.dk> |
| --- |
| t/io_uring.c | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| diff --git a/t/io_uring.c b/t/io_uring.c |
| index 0a90f85c..b90bcf78 100644 |
| --- a/t/io_uring.c |
| +++ b/t/io_uring.c |
| @@ -615,7 +615,7 @@ static void init_io_pt(struct submitter *s, unsigned index) |
| sqe->opcode = IORING_OP_URING_CMD; |
| sqe->user_data = (unsigned long) f->fileno; |
| if (stats) |
| - sqe->user_data |= ((unsigned long)s->clock_index << 32); |
| + sqe->user_data |= ((__u64) s->clock_index << 32ULL); |
| sqe->cmd_op = NVME_URING_CMD_IO; |
| slba = offset >> f->lba_shift; |
| nlb = (bs >> f->lba_shift) - 1; |