cpukit/librtemscxx: Initialize spolicy in start_thread

CID 1592923: Uninitialized scalar variable.

The 'spolicy' variable in thread::start_thread was declared without
initialization. Although the subsequent switch statement assigns
a value, Coverity flagged this as a risk.

This patch initializes 'spolicy' to SCHED_FIFO at declaration.
SCHED_FIFO was chosen because it matches the existing 'default'
case in the switch statement, ensuring consistency.

cpukit/librtemscxx: Initialize spolicy in start_thread (CID 1592923)

Restore default block for switch statement consistency
This commit is contained in:
M Mithilesh
2026-02-08 00:34:47 +05:30
committed by Kinsey Moore
parent 3d396291c3
commit 2e08b935b4

View File

@@ -334,7 +334,7 @@ void thread::start_thread(thread::state_ptr s) {
pthread_attr_t pattr;
system_error_check(::pthread_attr_init(&pattr), "attribute init");
int spolicy;
int spolicy = SCHED_FIFO;
switch (attr.get_scheduler_policy()) {
case attributes::sched_other:
spolicy = SCHED_OTHER;