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 :209382] Pointless string comparison in tests/lib/devicetree/src/main.c #24027

Closed
zephyrbot opened this issue Apr 2, 2020 · 1 comment
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/29c0c08fd4abc34aae4e1bf579cc506eaabef428/tests/lib/devicetree/src/main.c#L1064

Category: Incorrect expression
Function: test_chosen
Component: Tests
CID: 209382

Details:

1058     }
1059    
1060     static void test_chosen(void)
1061     {
1062         zassert_equal(DT_HAS_CHOSEN(ztest_xxxx), 0, "ztest_xxxx");
1063         zassert_equal(DT_HAS_CHOSEN(ztest_gpio), 1, "ztest_gpio");
>>>     CID 209382:  Incorrect expression  (CONSTANT_EXPRESSION_RESULT)
>>>     "strcmp("DT_N_S_test_S_gpio_deadbeef", "DT_N_S_test_S_gpio_deadbeef")" is always 0 because ""DT_N_S_test_S_gpio_deadbeef"" is compared against itself.
1064         zassert_true(!strcmp(TO_STRING(DT_CHOSEN(ztest_gpio)),
1065                      "DT_N_S_test_S_gpio_deadbeef"),
1066                  "chosen");
1067     }
1068    
1069     static void test_enums(void)

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 Apr 2, 2020
@nashif nashif assigned mbolivar-nordic and unassigned nashif Apr 2, 2020
@galak
Copy link
Collaborator

galak commented Apr 2, 2020

False positive, this is what the test is trying to do.

@galak galak closed this as completed Apr 2, 2020
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

No branches or pull requests

4 participants