Repository navigation
Commit 49f9130
mm/mm_heap: fix null pointer dereference in mm_foreach
On the first loop iteration prev is NULL. If the heap start node
has a corrupted preceding field with MM_PREVFREE_BIT set, the
short-circuit evaluation of the DEBUGASSERT falls through to
MM_SIZEOF_NODE(prev) which dereferences NULL.
Add a prev == NULL guard so the preceding-size consistency check
is skipped for the first node, which has no predecessor.
CID 1817303 (#1 of 1): Dereference null pointer (NULL_RETURNS)
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>1 parent b8b17f6 commit 49f9130
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
0 commit comments