You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/01/02 16:49:11 UTC

[GitHub] andrzej-kaczmarek commented on a change in pull request #715: os_mempool; block size for memory pool has to allow storage for free ?

andrzej-kaczmarek commented on a change in pull request #715: os_mempool; block size for memory pool has to allow storage for free ?
URL: https://github.com/apache/mynewt-core/pull/715#discussion_r159265469
 
 

 ##########
 File path: kernel/os/src/os_mempool.c
 ##########
 @@ -90,7 +90,7 @@ os_mempool_init(struct os_mempool *mp, int blocks, int block_size,
     struct os_memblock *block_ptr;
 
     /* Check for valid parameters */
-    if (!mp || (blocks < 0) || (block_size <= 0)) {
+    if (!mp || (blocks < 0) || (block_size < sizeof(struct os_memblock))) {
 
 Review comment:
   IMO block_size<=0 check is fine since this checks size of block as seen for application, not as it is required internally. We may add note to documentation about required minimum effective block size if someone decides not to use OS_MEMPOOL_BYTES() macro to get proper size.
   
   But even without such note for  block_size<4 user needs to assume at least 4 bytes for each block anyway - documentation clearly states that effective block size is OS_ALIGN-ed so anything less than 4 bytes is aligned to 4 bytes for all archs now (since we have only 32-bit archs).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services