mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-03-25 06:44:44 +08:00
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:
committed by
Kinsey Moore
parent
3d396291c3
commit
2e08b935b4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user