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. --- libhw_cr/w5500_ll.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libhw_cr/w5500_ll.h') diff --git a/libhw_cr/w5500_ll.h b/libhw_cr/w5500_ll.h index 2506cd2..8b98f9d 100644 --- a/libhw_cr/w5500_ll.h +++ b/libhw_cr/w5500_ll.h @@ -10,10 +10,10 @@ #ifndef _LIBHW_CR_W5500_LL_H_ #define _LIBHW_CR_W5500_LL_H_ -#include /* for alloca() */ #include /* for uint{n}_t */ #include /* for memcmp() */ +#include /* for stack_alloc() */ #include /* for assert(), static_assert() */ #include /* for uint16be_t */ @@ -94,7 +94,7 @@ w5500ll_writev( (block & CTL_MASK_BLOCK) | CTL_W | CTL_OM_VDM, }; int inner_cnt = 1+io_slice_cnt(iov, iovcnt, skip, max); - struct duplex_iovec *inner = alloca(sizeof(struct duplex_iovec)*inner_cnt); + struct duplex_iovec *inner = stack_alloc(inner_cnt, struct duplex_iovec); inner[0] = (struct duplex_iovec){ .iov_read_to = IOVEC_DISCARD, .iov_write_from = header, @@ -131,7 +131,7 @@ w5500ll_readv( (block & CTL_MASK_BLOCK) | CTL_R | CTL_OM_VDM, }; int inner_cnt = 1+io_slice_cnt(iov, iovcnt, 0, max); - struct duplex_iovec *inner = alloca(sizeof(struct duplex_iovec)*inner_cnt); + struct duplex_iovec *inner = stack_alloc(inner_cnt, struct duplex_iovec); inner[0] = (struct duplex_iovec){ .iov_read_to = IOVEC_DISCARD, .iov_write_from = header, -- cgit v1.2.3-2-g168b