lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #7928] Fixed size calculation in MALLOC memory pool


From: Stathis Voukelatos
Subject: [lwip-devel] [patch #7928] Fixed size calculation in MALLOC memory pool creation macro
Date: Fri, 18 Jan 2013 08:43:11 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17

URL:
  <http://savannah.nongnu.org/patch/?7928>

                 Summary: Fixed size calculation in MALLOC memory pool
creation macro
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: stathisv
            Submitted on: Fri 18 Jan 2013 08:43:10 GMT
                Category: pbufs
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

The LWIP_MALLOC_MEMPOOL macro needs to use the aligned size of the
memp_malloc_helper structure, since mem_alloc() uses that to calculate the
required pool element size. If LWIP_MEM_ALIGN_SIZE(x) is redefined to align to
something larger than 4, then in some cases the current code can lead to
unexpected mem_alloc() failures.
For example:
    #define LWIP_MEM_ALIGN_SIZE(size)  (((size) + 31) & ~31)
and the largest MALLOC pool is of size 60 bytes, e.g.:
    #define LWIP_MALLOC_MEMPOOL(256, 60)
then the following call:
    mem_malloc(58)
will cause an assertion.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 18 Jan 2013 08:43:10 GMT  Name: 0001-malloc-memory-pool.patch  Size:
2kB   By: stathisv

<http://savannah.nongnu.org/patch/download.php?file_id=27298>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?7928>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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