You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/17 15:32:24 UTC

[GitHub] [incubator-nuttx] minabeoki opened a new pull request #5532: mm: fix gran_alloc() array index range checking

minabeoki opened a new pull request #5532:
URL: https://github.com/apache/incubator-nuttx/pull/5532


   ## Summary
   
   At the last loop `if (granidx < priv->ngranules)` condition is ture,
   `priv->gat[gatidx + 1]` reference to out of range.
   
   So, correct condition of next entry is `if (granidx + 32 < priv->ngranules)`.
   
   ## Impact
   
   gran_alloc() function use
   
   ## Testing
   
   test running on custom Cortex-A9 board.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #5532: mm: fix gran_alloc() array index range checking

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #5532:
URL: https://github.com/apache/incubator-nuttx/pull/5532#issuecomment-1043708206


   @minabeoki 
   Looks good to me but could you tell us how to reproduce the bug?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] minabeoki commented on pull request #5532: mm: fix gran_alloc() array index range checking

Posted by GitBox <gi...@apache.org>.
minabeoki commented on pull request #5532:
URL: https://github.com/apache/incubator-nuttx/pull/5532#issuecomment-1043806170


   @masayuki2009
   We can reproduce this by following sequence.
   
   * use a config with CONFIG_GRAN=y
   * add the following code somewhere
   
   ```
   #include <nuttx/mm/gran.h>
   
   static GRAN_HANDLE gran;
   static uint32_t area[32];
   
   void gran_test(void)
   {
     gran = gran_initialize(area, sizeof(area), 2, 2);
     gran_alloc(gran, 8);
   }
   ```
   
   * call gran_test() and `next = priv->gat[gatidx + 1];` accesses the out of range for gat[]
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5532: mm: fix gran_alloc() array index range checking

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5532:
URL: https://github.com/apache/incubator-nuttx/pull/5532


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org