Skip to content

[Coverity CID :197616]Null pointer dereferences in /subsys/testsuite/ztest/src/ztest_mock.c #15388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aasthagr opened this issue Apr 12, 2019 · 2 comments
Labels
area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix

Comments

@aasthagr
Copy link
Collaborator

Static code scan issues seen in File: /subsys/testsuite/ztest/src/ztest_mock.c
Category: Null pointer dereferences
Function: z_ztest_get_return_value
Component: Other
CID: 197616
Please fix or provide comments to square it off in coverity in the link: https://scan9.coverity.com/reports.htm#v32951/p12996

@aasthagr aasthagr added area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels Apr 12, 2019
@aasthagr
Copy link
Collaborator Author

*** CID 197616: Null pointer dereferences (FORWARD_NULL)
/subsys/testsuite/ztest/src/ztest_mock.c: 226 in z_ztest_get_return_value()
220
221 if (!param) {
222 PRINT("Failed to find return value for function %s\n", fn);
223 ztest_test_fail();
224 }
225

CID 197616:  Null pointer dereferences  (FORWARD_NULL)
Dereferencing null pointer "param".

226 value = param->value;
227 free_parameter(param);
228
229 return value;
230 }
231

@aescolar
Copy link
Member

False positive. Confirmed by @mtpr-ot ("the ztest_test_fail() will abort the process if param == NULL, so no NULL pointer dereference is possible."). Flagged as false positive in the tool..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Other bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix
Projects
None yet
Development

No branches or pull requests

2 participants