Skip to content

Commit 6eb17a0

Browse files
karlbohlmarkandrewrk
authored andcommitted
fix integer overflow in IoUring buffer ring size calculation
1 parent d4d1efe commit 6eb17a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/os/linux/IoUring.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ pub fn setup_buf_ring(fd: posix.fd_t, entries: u16, group_id: u16) !*align(mem.p
15591559
if (entries == 0 or entries > 1 << 15) return error.EntriesNotInRange;
15601560
if (!std.math.isPowerOfTwo(entries)) return error.EntriesNotPowerOfTwo;
15611561

1562-
const mmap_size = entries * @sizeOf(linux.io_uring_buf);
1562+
const mmap_size = @as(usize, entries) * @sizeOf(linux.io_uring_buf);
15631563
const mmap = try posix.mmap(
15641564
null,
15651565
mmap_size,

0 commit comments

Comments
 (0)