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 :219541] Unused value in subsys/bluetooth/controller/ticker/ticker.c #32908

Closed
zephyrbot opened this issue Mar 5, 2021 · 1 comment · Fixed by #33413
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:/zephyrproject-rtos/zephyr/tree/bd97359a5338b2542d19011b6d6aa1d8d1b9cc3f/subsys/bluetooth/controller/ticker/ticker.c#L1817

Category: Code maintainability issues
Function: ticker_job_reschedule_in_window
Component: Bluetooth
CID: 219541

Details:

ticker_id_prev = ticker_id_iter;

1811                 ticks_start_offset += node->ticks_to_expire;
1812                 window_start_ticks  = node->ticks_to_expire +
1813                               node->ticks_slot;
1814                 ticks_to_expire     = ticks_slot_window -
1815                               ticker->ticks_slot;
1816    
>>>     CID 219541:  Code maintainability issues  (UNUSED_VALUE)
>>>     Assigning value from "ticker_id_iter" to "ticker_id_prev" here, but that stored value is overwritten before it can be used.
1817                 ticker_id_prev = ticker_id_iter;
1818                 ticker_id_iter = node->next;
1819             }
1820    
1821             ticker->ticks_to_expire = ticks_to_expire;
1822             ticker_id_iter = nodes[ticker_id_head].next;

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 Mar 5, 2021
@gudnimg
Copy link
Contributor

gudnimg commented Mar 12, 2021

It looks like we can remove lines 1734 and 1817 to fix this. The value assignment does not seem to be used.

Does the if statement in line 1844 ever evaluate to true? Can we remove ticker_id_prev alltogether?

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.

6 participants