Skip to content
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

[Coverity CID :205823] Null pointer dereferences in tests/kernel/fifo/fifo_timeout/src/main.c #20877

Closed
zephyrbot opened this issue Nov 20, 2019 · 1 comment · Fixed by #21085
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: low Low impact/importance bug

Comments

@zephyrbot
Copy link
Collaborator

Static code scan issues found in file:

https://github.com/zephyrproject-rtos/zephyr/tree/master/tests/kernel/fifo/fifo_timeout/src/main.c

Category: Null pointer dereferences
Function: test_multiple_threads_pending
Component: Tests
CID: 205823

Please fix or provide comments in coverity using the link:

https://scan9.coverity.com/reports.htm#v32951/p12996.

@zephyrbot zephyrbot added bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: low Low impact/importance bug labels Nov 20, 2019
@andyross
Copy link
Contributor

Triage for whoever's benefit: this one is real enough.

test_multiple_threads_pending() does a k_fifo_get() to retrieve a data pointer and then dereferences it to log its fields in a TC_PRINT() at line 162. The test is making assumptions about the data environment to assume that the get never returns a NULL, but it technically can and coverity wants that case checked.

It's probably enough to put a z_assert_true(data != NULL, ""); ahead of the use, though it might be safer to wrap the dereferences in an if() instead.

nashif added a commit to nashif/zephyr that referenced this issue Nov 29, 2019
Fix Null pointer dereferences.

Fixes zephyrproject-rtos#20877
Coverity CID: 205823

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Dec 1, 2019
Fix Null pointer dereferences.

Fixes zephyrproject-rtos#20877
Coverity CID: 205823

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Dec 10, 2019
Fix Null pointer dereferences.

Fixes #20877
Coverity CID: 205823

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants