MITHILESH MATTAPALLI created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1053

Project:Branches: mithileshm/rtems:fix-cxx-thread-uninit to 
rtems/rtos/rtems:main
Author:   MITHILESH MATTAPALLI



**Summary**

Initialize the scalar variable spolicy in thread::start_thread to prevent 
potential use of an uninitialized variable.

Analysis: Static analysis (Coverity) flagged the spolicy variable in 
cpukit/librtemscxx/thread.cpp as an uninitialized scalar. While the subsequent 
switch statement logic covers the known cases, there is a theoretical path 
where the variable could remain uninitialized before being passed to 
pthread_attr_setschedpolicy.

This patch initializes spolicy to SCHED_FIFO at the point of declaration. 
SCHED_FIFO was selected because it matches the existing default case fallback 
in the switch statement, ensuring the fix is consistent with the original 
design intent.

Testing:

* Built cpukit successfully with the change.
* Verified that the initialization value matches the logic in the existing 
default switch case.

Generative AI: None used

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1053
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to