You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "CV-Bowen (via GitHub)" <gi...@apache.org> on 2023/01/30 02:14:03 UTC

[GitHub] [nuttx] CV-Bowen commented on a diff in pull request #8339: mm_memalign: avoid two adjacent free nodes situation.

CV-Bowen commented on code in PR #8339:
URL: https://github.com/apache/nuttx/pull/8339#discussion_r1090119803


##########
mm/mm_heap/mm_memalign.c:
##########
@@ -146,11 +146,18 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
     {
       FAR struct mm_allocnode_s *newnode;
       FAR struct mm_allocnode_s *next;
+      FAR struct mm_freenode_s *prev;
       size_t precedingsize;
 
+      /* Mark node free */
+
+      node->preceding &= ~MM_MASK_BIT;
+
       /* Get the node the next node after the allocation. */
 
       next = (FAR struct mm_allocnode_s *)((FAR char *)node + node->size);
+      prev = (FAR struct mm_freenode_s *)
+        ((FAR char *)node - node->preceding);

Review Comment:
   I tried, it's 79 chars, checkpatch.sh report this:
   ```shell
   wangbowen@ubuntu:~/project/community/nuttx_rpmsg_server/nuttx$ tools/checkpatch.sh -g HEAD~...HEAD
   /home/wangbowen/project/community/nuttx_rpmsg_server/nuttx/mm/mm_heap/mm_memalign.c:159:78: error: Long line found
   ```



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