FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.51k stars 1.05k forks source link

[BUG] Violation of MISRA2012 rule 17.11 - A function that never returns should be declared with a _Noreturn function specifier #1057

Closed markhermeling closed 3 weeks ago

markhermeling commented 1 month ago

Describe the bug In the Coverity example configuration there are 4 places where a function is used that does not return. See the attached SARIF file from a run with CodeSecure CodeSonar. This is a violation of MISRA 17.11, though admittedly not a key rule.

Target

Host

To Reproduce

Expected behavior The specified functions should be defined with _Noreturn, or rule 17.11 should be added as a deviation. I am happy to provide a PR with either of these done, but wanted to file the issue first to understand what the project prefers.

I am working on a few more MISRA violation as it seems that Coverity missed a few rules. Once done, I plan to submit a codesonar example project as well to make it easier for users to run CodeSonar on FreeRTOS.

Misra17-11-violations.sarif.zip

kar-rahul-aws commented 1 month ago

Hi @markhermeling Thank you for reporting the issue. We are having a discussion with the team, on the proper approach to address the issue for all ports. We will reply back shortly, with the proposed changes, if any.

Thanks.

kar-rahul-aws commented 1 month ago

Hi @markhermeling We have raised a PR #1060 to address the issue you reported. Can you please test with this patch and let us know if this fixes your issue?

Thanks.

markhermeling commented 1 month ago

We are having a discussion with the team, on the proper approach to address the issue for all ports.

I have another couple of issues to report. Looking for suggestions from the team as to how to approach.

What I would like to do is to submit a codesonar example and make a PR with that and suggested code changes if that is easiest.

I can also add CodeSonar either to the pipeline in the repo, or run it once per day and publish the results.

n9wxu commented 1 month ago

We recently started running sonarcube experimentally but it is not tied to PR checks and we may have different configurations. The easiest path may be submitting a PR with a test run and your changes. Then we can directly comment on the proposed changes and discuss any configuration differences.

n9wxu commented 1 month ago

Looks like the kernel is doing sonar checks in the PR. This PR shows the result. https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/353

kar-rahul-aws commented 3 weeks ago

We have linked Code Sonar here - https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/.github/third_party_tools.md.