patchlwIP - A Lightweight TCP/IP stack - Patches: patch #10088, allow "typedef u32_t...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10088: allow "typedef u32_t mem_size_t" when MEM_SIZE > 640000L and MEM_USE_POOLS

Submitted by:  ODH <odh>
Submitted on:  Wed 21 Jul 2021 08:51:33 PM UTC
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Wed 04 Aug 2021 12:20:22 PM UTC, comment #1: 

Title needs changed: 640000 -> 64000 (one too many zeroes)

ODH <odh>
Wed 21 Jul 2021 08:51:33 PM UTC, original submission:  

Currently, while MEM_USE_POOLS is true,
u16_t is forced for mem_size_t, even when MEM_SIZE cannot fit into a type as small as u16_t.
The following patch duplicates the test used if MEM_USE_POOLS is false, and which, if MEM_SIZE > 64000, uses u32_t for mem_size_t.

This allows MEM_USE_POOLS while MEM_SIZE > 0xFFFFU without an overflow error.

Patch below:

diff --git a/src/include/lwip/mem.h b/src/include/lwip/mem.h
index ff208d25..76aeda56 100644
--- a/src/include/lwip/mem.h
+++ b/src/include/lwip/mem.h
@@ -52,8 +52,17 @@ typedef size_t mem_size_t;

 #elif MEM_USE_POOLS

+/* MEM_SIZE would have to be aligned, but using 64000 here instead of
+ * 65535 leaves some room for alignment...
+ */
+#if MEM_SIZE > 64000L
+typedef u32_t mem_size_t;
+#define MEM_SIZE_F U32_F
+#else
 typedef u16_t mem_size_t;
 #define MEM_SIZE_F U16_F
+#endif /* MEM_SIZE > 64000 */
+#endif

 #else

ODH <odh>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by odh (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.9