-
Notifications
You must be signed in to change notification settings - Fork 1.5k
sched/task: MISRA/Coverity cleanups in scheduler, init, libc spawn, and ARMv8-R IRQ helpers #18016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xiaoxiang781216
merged 7 commits into
apache:master
from
fxysunshine:misra-fixes-20260119
Jan 21, 2026
Merged
sched/task: MISRA/Coverity cleanups in scheduler, init, libc spawn, and ARMv8-R IRQ helpers #18016
xiaoxiang781216
merged 7 commits into
apache:master
from
fxysunshine:misra-fixes-20260119
Jan 21, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use a local ret variable and return once at the end. This keeps the IDLE_PROCESS_ID fallback behavior unchanged. Addresses Coverity HIS_metric_violation: RETURN. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Replace early return with a ret flag to unify the exit path. Keep critical section behavior unchanged while simplifying control flow. Addresses Coverity HIS_metric_violation: RETURN. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Initialize ret and propagate scheduler/param errors via a single return. Make spawn_file_is_duplicateable() decision explicit using a dup state. Addresses Coverity HIS_metric_violation: RETURN. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Refactor nxtask_setup_stackargs() to use a single ret exit path. Avoid partially-initialized state on error paths and improve readability. Addresses Coverity HIS_metric_violation: RETURN. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Use 1u/~1u constants for TPIDRPRW bit operations. Avoid implicit conversion to a different underlying type (MISRA Rule 10.3). No functional change to task pointer tagging logic. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Zero-initialize posix_spawnattr_t in posix_spawnattr_init(). Prevent use of uninitialized fields reported by Coverity. Preserve existing default flag initialization. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Change g_nx_initstate type from uint8_t to enum nx_initstate_e. Avoid enum/integer base-type mismatch in init state comparisons. Satisfies MISRA C:2012 Rule 10.4 without behavior change. Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
acassis
approved these changes
Jan 19, 2026
xiaoxiang781216
approved these changes
Jan 19, 2026
anchao
previously requested changes
Jan 19, 2026
jerpelea
approved these changes
Jan 20, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Arch: arm
Issues related to ARM (32-bit) architecture
Area: OS Components
OS Components issues
Size: M
The size of the change in this PR is medium
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses a small set of MISRA C:2012 and Coverity findings across NuttX core code.
The changes are focused on type-safety, initialization, and simplifying return paths without altering intended behavior.
Key updates:
g_nx_initstate.1u,~1u) for bit operations.posix_spawnattr_tinposix_spawnattr_init().Impact
sched/task/*)include/nuttx/init.h,sched/init/nx_start.c)libs/libc/spawn/lib_psa_init.c)arch/arm/include/armv8-r/irq.h)Testing