zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.6k stars 6.49k forks source link

[Coverity CID: 392509] Logically dead code in lib/posix/options/shm.c #74818

Closed zephyrbot closed 1 month ago

zephyrbot commented 3 months ago

Static code scan issues found in file:

https://github.com/zephyrproject-rtos/zephyr/tree/dcf42917c550714d2457947538b9e29d083e872e/lib/posix/options/shm.c

Category: Control flow issues Function: shm_open Component: Other CID: 392509

Details:

https://github.com/zephyrproject-rtos/zephyr/blob/dcf42917c550714d2457947538b9e29d083e872e/lib/posix/options/shm.c#L318

Please fix or provide comments in coverity using the link:

https://scan9.scan.coverity.com/#/project-view/29271/12996?selectedIssue=392509

For more information about the violation, check the Coverity Reference. (CWE-561)

Note: This issue was created automatically. Priority was set based on classification of the file affected and the impact field in coverity. Assignees were set using the MAINTAINERS file.

cfriedt commented 3 months ago

This is likely less of a problem now. Originally when I made the PR, the truncate flag was not available (possibly added in the posix-device-io or posix-fd-mgmt pr).

This code should not be removed, but I will keep the issue open unless the truncate flag is available.