diff --git a/lib/os/spsc_pbuf.c b/lib/os/spsc_pbuf.c index f58ad9000fd..967869fb2e8 100644 --- a/lib/os/spsc_pbuf.c +++ b/lib/os/spsc_pbuf.c @@ -184,7 +184,7 @@ int spsc_pbuf_alloc(struct spsc_pbuf *pb, uint16_t len, char **buf) } } } else { - free_space = rd_idx - wr_idx - 1; + free_space = rd_idx - wr_idx - sizeof(uint32_t); } len = MIN(len, MAX(free_space - (int32_t)LEN_SZ, 0));