lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [patch #10132] fix pbuf->len calculation error in type PBUF


From: Erik Ekman
Subject: [lwip-devel] [patch #10132] fix pbuf->len calculation error in type PBUF_POOL
Date: Wed, 24 Nov 2021 18:02:04 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36

Follow-up Comment #2, patch #10132 (project lwip):

The PBUF_POOL mempool is allocated with a special macro that adds the size of
the pbuf struct to the requested size:


#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)


`PBUF_POOL_BUFSIZE_ALIGNED` is how many bytes are available after the struct -
so the size of the struct should not need to be subtracted here.

Wouldn't memory be corrupted very quickly if this actually was broken - since
this is used for every RX?

Can you add a unit test for this to show the issue (that fails without this
patch and works with it)?


    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?10132>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]