Conversation
|
@Sarah5567 thanks a lot for contributing another round of static analysis fixes. Just a heads up, we're pretty busy this week and on top of that our CI system is failing because of a registry that was taken offline (was providing us with raspberrypi cross compilers). So we'll likely have to wait next week before we can start merging things again, unless we decide to overrule CI in the meantime. |
|
Hi, Thank you for this (and other PRs). |
|
Hi, thanks for the review. Below is the rationale behind each false positive. cpp:S3657 - Condition Variable - Condition Variable - File System Race Condition - Division By Zero - Please let me know if anything is unclear or if any of my assumptions are incorrect. |
|
Hi @djbyrne17, is there anything else I need to do regarding the CI? The formatting checks are failing because of NO_CODESONAR. |
|
Hi @Sarah5567, please run this command on each file that you changed: or if you're confident, this should get all files in a one-liner: Looks like the files were flagged because of using a single space before the comment, rather than a double space. Nit-picky computer; such is the price we pay for consistency! So the format cmd shown will modify your code to match the FPrime styles. There's a note in our (Contributing Guidelines)[https://github.com/nasa/fprime/blob/devel/CONTRIBUTING.md] under "Helpful Hints", but since it's required we should move that to a different section; I'll get on that. Thanks! |
|
Thank you! This looks very good. We're all running a 5-day Workshop this week, so may be slow with the final review and merge, but it's on track. |
Change Description
This PR addresses high-severity static analysis findings reported by SonarQube and CodeSonar in the
Oscomponent:SonarQube rule S3657 (virtual assignment operators): The virtual assignment operators are defined as
= deleteand intentionally kept virtual to ensure the same deleted operator applies consistently in derived classes as well. No code change was made. a// NOSONAR (cpp:S3657)comment was added solely to suppress this warning.Uninitialized Variable (
Os/File.cpp:272): Added explicit initialization to eliminate undefined behavior.Integer / Multiplication Overflow of Allocation Size: Added explicit overflow checks in
Os/Generic/PriorityQueue.cppandOs/Generic/Types/MaxHeap.cpp.Condition Variable Warnings:
Inappropriate Call Outside LoopinPosixConditionVariable::pend: No functional change. The API is intentionally designed to require the caller to handle spurious wakeups by callingpend()inside a loop.Use of Condition Variable Signalinnotify(): No functional change. The use ofpthread_cond_signalis correct and intentional.File System Race Condition (
Os/Posix/Directory.cpp): there is a time window between the call tomkdir(path, ...)and the later call toopendir(path). Since the filesystem is shared state, another process/thread can modify the directory entry atpathin between these two operations. As a result,opendirmay end up opening a directory that is not the one this function just created, or it may fail because the directory was removed/changed after creation.Is this actually something we need to prevent, or is the current behavior acceptable by design? Would be happy to hear feedback on this.
Division By Zero (
Os/Posix/FileSystem.cpp:86): Code already contained an explicit guard againstblock_size == 0.AI Usage (see policy)
ChatGPT was used to help locate and understand the reported static analysis findings.