Skip to content
Commit f5f95ee3 authored by Leandro Pereira's avatar Leandro Pereira Committed by Anas Nashif
Browse files

kernel: sem: Ensure that initial count is lesser or equal than limit



Ensure this value during static initialization (with build assertions),
and dynamic initializations through system calls.

If initial count is larger than the limit, it's possible for the count
to wraparound, causing locking issues.

Expanding the BUILD_ASSERT() macros after declaring a k_sem struct in
K_SEM_DEFINE() is necessary to support cases where a semaphore is
defined statically.

Signed-off-by: default avatarLeandro Pereira <leandro.pereira@intel.com>
parent 05169a02
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment