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 :216798] Unused value in subsys/net/lib/sockets/socketpair.c #31644

Closed
zephyrbot opened this issue Jan 26, 2021 · 1 comment
Closed
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/f91e9fba51e5da46ee5c6822f8656713d74a6ecf/subsys/net/lib/sockets/socketpair.c#L704

Category: Code maintainability issues
Function: spair_read
Component: Networking
CID: 216798

Details:

698    
699         res = k_pipe_get(&spair->recv_q, (void *)buffer, count, &bytes_read,
700                  1, K_NO_WAIT);
701         __ASSERT(res == 0, "k_pipe_get() failed: %d", res);
702    
703         if (is_connected) {
>>>     CID 216798:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "k_poll_signal_raise(&spair->read_signal, SPAIR_SIG_DATA)" to "res" here, but that stored value is overwritten before it can be used.
704             res = k_poll_signal_raise(&spair->read_signal, SPAIR_SIG_DATA);
705             __ASSERT(res == 0, "k_poll_signal_raise() failed: %d", res);
706         }
707    
708         res = bytes_read;
709    

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 Jan 26, 2021
@cfriedt
Copy link
Member

cfriedt commented Feb 1, 2021

Marked this as a false positive in coverity, as the variable is used in that particular scope when assertions are enabled.

@cfriedt cfriedt closed this as completed Feb 1, 2021
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

5 participants