diff --git a/include/zephyr/net/buf.h b/include/zephyr/net/buf.h index 9b1d5af16b3..88152bc9905 100644 --- a/include/zephyr/net/buf.h +++ b/include/zephyr/net/buf.h @@ -1049,7 +1049,7 @@ struct net_buf { /** @endcond */ }; - /** System metadata for this buffer. */ + /** System metadata for this buffer. Cleared on allocation. */ uint8_t user_data[] __net_buf_align; }; diff --git a/subsys/net/buf.c b/subsys/net/buf.c index 8267943dc01..6f0ee42f5c2 100644 --- a/subsys/net/buf.c +++ b/subsys/net/buf.c @@ -338,6 +338,7 @@ success: buf->flags = 0U; buf->frags = NULL; buf->size = size; + memset(buf->user_data, 0, buf->user_data_size); net_buf_reset(buf); #if defined(CONFIG_NET_BUF_POOL_USAGE)