t/io_uring: fix 64-bit cast on 32-bit archs
authorJens Axboe <axboe@kernel.dk>
Fri, 26 Aug 2022 13:52:54 +0000 (07:52 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 26 Aug 2022 13:52:54 +0000 (07:52 -0600)
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

index 0a90f85c55ad73a6ea5117dffec1607c979fdbd2..b90bcf789b272c0f3a7bfb516cee7395a67cf346 100644 (file)
@@ -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;