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 :214214] Uninitialized pointer read in tests/benchmarks/data_structure_perf/rbtree_perf/src/rbtree_perf.c #28175

Closed
zephyrbot opened this issue Sep 8, 2020 · 1 comment · Fixed by #28212
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/27e1fd69f987d3082229b3368a87d59ffdcab5a4/tests/benchmarks/data_structure_perf/rbtree_perf/src/rbtree_perf.c#L58

Category: Memory - illegal accesses
Function: test_rbtree_container
Component: Tests
CID: 214214

Details:

52         struct rbnode *foreach_node;
53         struct container_node tree_node[10];
54    
55         test_tree_l.lessthan_fn = node_lessthan;
56         for (uint32_t i = 0; i < ARRAY_SIZE(tree_node); i++) {
57             tree_node[i].value = i;
>>>     CID 214214:  Memory - illegal accesses  (UNINIT)
>>>     Using uninitialized value "test_tree_l.max_depth" when calling "rb_insert".
58             rb_insert(&test_tree_l, &tree_node[i].node);
59         }
60    
61         RB_FOR_EACH(&test_tree_l, foreach_node) {
62             zassert_true(CONTAINER_OF(foreach_node, struct container_node,
63             node)->value == count, "RB_FOR_EACH failed");

Please fix or provide comments in coverity using the link:

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

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 CODEOWNERS file.

@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 Sep 8, 2020
Zhaoningx added a commit to Zhaoningx/zephyr that referenced this issue Sep 9, 2020
add 'memset' to initialize rbtree and its node to fix the issue zephyrproject-rtos#28175

Signed-off-by: Ningx Zhao <[email protected]>
@Zhaoningx
Copy link
Collaborator

I have added the solution to solve the bug, and I'll close this issue if there is no longer anything wrong.

nashif pushed a commit that referenced this issue Oct 21, 2020
add 'memset' to initialize rbtree and its node to fix the issue #28175

Signed-off-by: Ningx Zhao <[email protected]>
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.

2 participants