From db9a58f48c6eae16fbfcd89d59b09e123dbed54f Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 15 Apr 2025 15:58:31 -0600 Subject: libmisc: Add alloc.h to help detect wrong alloc sizes Lo and behold, there was a mistake in chan.c. --- libcr_ipc/chan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libcr_ipc/chan.c') diff --git a/libcr_ipc/chan.c b/libcr_ipc/chan.c index 6cbe890..f20b8a0 100644 --- a/libcr_ipc/chan.c +++ b/libcr_ipc/chan.c @@ -4,10 +4,10 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#include /* for alloca() */ #include /* for memcpy() */ #include /* for cid_t, cr_* */ +#include #include #include @@ -150,7 +150,7 @@ size_t cr_select_v(size_t arg_cnt, struct cr_select_arg arg_vec[]) { struct cr_select_waiters waiters = { .cnt = arg_cnt, .args = arg_vec, - .nodes = alloca(sizeof(struct cr_chan_waiter) * arg_cnt), + .nodes = stack_alloc(arg_cnt, struct _cr_chan_waiter_list_node), }; for (size_t i = 0; i < arg_cnt; i++) { waiters.nodes[i] = (struct _cr_chan_waiter_list_node){ .val = { -- cgit v1.2.3-2-g168b