mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
fix integer overflow in IoUring buffer ring size calculation
This commit is contained in:
parent
fa4a626fac
commit
4616fb0937
@ -1559,7 +1559,7 @@ pub fn setup_buf_ring(fd: posix.fd_t, entries: u16, group_id: u16) !*align(mem.p
|
||||
if (entries == 0 or entries > 1 << 15) return error.EntriesNotInRange;
|
||||
if (!std.math.isPowerOfTwo(entries)) return error.EntriesNotPowerOfTwo;
|
||||
|
||||
const mmap_size = entries * @sizeOf(linux.io_uring_buf);
|
||||
const mmap_size = @as(usize, entries) * @sizeOf(linux.io_uring_buf);
|
||||
const mmap = try posix.mmap(
|
||||
null,
|
||||
mmap_size,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user