mutex_init() fails to initialize the 'owned' field #36

Closed
opened 2021-01-28 07:05:54 -06:00 by geurtv · 2 comments
geurtv commented 2021-01-28 07:05:54 -06:00 (Migrated from github.com)

mutex_init() fails to initialize the 'owned' field of mutex_t. So a malloc'ed mutex or a mutex on the stack is likely to be locked (owned != 0) after mutex_init.

Also 'owner' is not initialized. It might make sense to '#ifndef NDEBUG' initialize it to -1 (like mutex_exit).

mutex_init() fails to initialize the 'owned' field of mutex_t. So a malloc'ed mutex or a mutex on the stack is likely to be locked (owned != 0) after mutex_init. Also 'owner' is not initialized. It might make sense to '#ifndef NDEBUG' initialize it to -1 (like mutex_exit).
kilograham commented 2021-01-28 07:26:10 -06:00 (Migrated from github.com)

good catch - i've always used static mutexes so never noticed!

good catch - i've always used static mutexes so never noticed!
kilograham commented 2021-01-31 16:48:17 -06:00 (Migrated from github.com)

merged into develop

merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#36
No description provided.