From 2fd2b6810e6a13b86669399edaa419485e273998 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 17 Jan 2018 12:51:49 +0100 Subject: [PATCH] memp_std.h: fix LWIP_PBUF_MEMPOOL element size for MEMP_OVERFLOW_CHECK The LWIP_PBUF_MEMPOOL define used MEMP_ALIGN_SIZE instead of LWIP_MEM_ALIGN_SIZE to calculate the element size of PBUF_POOL pbufs. This is wrong for MEMP_OVERFLOW_CHECK, since MEMP_ALIGN_SIZE adds MEMP_SANITY_REGION_AFTER_ALIGNED. This should be only added during pool_base buffer allocation but for PBUF_POOL, it changed the size of the pool elements. --- src/include/lwip/priv/memp_std.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/lwip/priv/memp_std.h b/src/include/lwip/priv/memp_std.h index 7ca03128..1223b123 100644 --- a/src/include/lwip/priv/memp_std.h +++ b/src/include/lwip/priv/memp_std.h @@ -28,7 +28,7 @@ #ifndef LWIP_PBUF_MEMPOOL /* This treats "pbuf pools" just like any other pool. * Allocates buffers for a pbuf struct AND a payload size */ -#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc) +#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) + LWIP_MEM_ALIGN_SIZE(payload)), desc) #endif /* LWIP_PBUF_MEMPOOL */