Skip to content

Commit eb4819d

Browse files
committed
Fix array-bounds compiler warning on gcc11+ in list.h
listGET_OWNER_OF_NEXT_ENTRY computes `( pxConstList )->pxIndex->pxNext` after verifying that `( pxConstList )->pxIndex` points to `xListEnd`, which due to being a MiniListItem_t, can be shorter than a ListItem_t. Thus, `( pxConstList )->pxIndex` is a `ListItem_t *` that extends past the end of the `List_t` whose `xListEnd` it points to. This is fixed by accessing `pxNext` through a `MiniListItem_t` instead.
1 parent 91927ab commit eb4819d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ typedef struct xLIST
290290
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
291291
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
292292
{ \
293-
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
293+
( pxConstList )->pxIndex = ( pxConstList )->xListEnd.pxNext; \
294294
} \
295295
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
296296
}

0 commit comments

Comments
 (0)