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 :214218] Unused value in subsys/mgmt/osdp/src/osdp.c #28168

Closed
zephyrbot opened this issue Sep 8, 2020 · 2 comments · Fixed by #28521
Closed

[Coverity CID :214218] Unused value in subsys/mgmt/osdp/src/osdp.c #28168

zephyrbot opened this issue Sep 8, 2020 · 2 comments · Fixed by #28521
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/subsys/mgmt/osdp/src/osdp.c#L62

Category: Code maintainability issues
Function: osdp_uart_isr
Component: Other
CID: 214218

Details:

56    
57             if (uart_irq_tx_ready(dev)) {
58                 len = ring_buf_get(&p->tx_buf, buf, 1);
59                 if (!len) {
60                     uart_irq_tx_disable(dev);
61                 } else {
>>>     CID 214218:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "uart_fifo_fill(dev, buf, 1)" to "wrote" here, but that stored value is overwritten before it can be used.
62                     wrote = uart_fifo_fill(dev, buf, 1);
63                 }
64             }
65         }
66     #ifdef CONFIG_OSDP_MODE_PD
67         /* wake osdp_refresh thread */

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
@MaureenHelm
Copy link
Member

@cbsiddharth will you please have a look?

@sidcha sidcha self-assigned this Sep 10, 2020
@sidcha
Copy link
Member

sidcha commented Sep 11, 2020

A commit in PR #28200 implicitly fixes this issue. Will amend that commit message to include this Coverity-ID.

@sidcha sidcha linked a pull request Sep 18, 2020 that will close this issue
sidcha added a commit to sidcha/zephyr that referenced this issue Oct 9, 2020
All OSDP packets must start with a mark byte (0xFF) followed by a Start
of Message byte (0x53). Skip all bytes received until such a sequence is
seen to to avoid waking up the refresh thread needlessly.

Also, refactor osdp_uart_isr() to reduce number of local variables.

Fixes: zephyrproject-rtos#28168 Coverity-ID: 214218

Signed-off-by: Siddharth Chandrasekaran <[email protected]>
carlescufi pushed a commit that referenced this issue Oct 21, 2020
All OSDP packets must start with a mark byte (0xFF) followed by a Start
of Message byte (0x53). Skip all bytes received until such a sequence is
seen to to avoid waking up the refresh thread needlessly.

Also, refactor osdp_uart_isr() to reduce number of local variables.

Fixes: #28168 Coverity-ID: 214218

Signed-off-by: Siddharth Chandrasekaran <[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.

4 participants