Skip to content

Commit

Permalink
Fix array-bounds compiler warning on gcc11+ in list.h (#580)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
archigup authored Dec 15, 2022
1 parent 91927ab commit 99d3d54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ typedef struct xLIST
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) ) \
{ \
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
( pxConstList )->pxIndex = ( pxConstList )->xListEnd.pxNext; \
} \
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
}
Expand Down

0 comments on commit 99d3d54

Please sign in to comment.