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 :203523]Error handling issues in /samples/drivers/counter/alarm/src/main.c #18374

Closed
aasthagr opened this issue Aug 17, 2019 · 2 comments · Fixed by #18707
Closed
Assignees
Labels
area: Samples Samples bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@aasthagr
Copy link
Collaborator

Static code scan issues seen in File: /samples/drivers/counter/alarm/src/main.c
Category: Error handling issues
Function: test_counter_interrupt_fn
Component: Samples
CID: 203523
Please fix or provide comments to square it off in coverity in the link: https://scan9.coverity.com/reports.htm#v32951/p12996

@aasthagr aasthagr added area: Samples Samples bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels Aug 17, 2019
@aasthagr
Copy link
Collaborator Author

*** CID 203523:  Error handling issues  (CHECKED_RETURN)
/samples/drivers/counter/alarm/src/main.c: 37 in test_counter_interrupt_fn()
31     	config->ticks = config->ticks * 2U;
32     
33     	printk("Set alarm in %u sec (%u ticks)\n",
34     	       (u32_t)(counter_ticks_to_us(counter_dev,
35     					   config->ticks) / USEC_PER_SEC),
36     	       config->ticks);
>>>     CID 203523:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "counter_set_channel_alarm" without checking return value (as is done elsewhere 6 out of 7 times).
37     	counter_set_channel_alarm(counter_dev, ALARM_CHANNEL_ID, user_data);
38     }
39     
40     void main(void)
41     {
42     	struct device *counter_dev;

@galak galak added the priority: low Low impact/importance bug label Aug 18, 2019
@aescolar
Copy link
Member

from da74431 #12668

@erwango erwango added the platform: STM32 ST Micro STM32 label Aug 27, 2019
erwango added a commit to erwango/zephyr that referenced this issue Aug 28, 2019
Error checking was missing following call to
counter_set_channel_alarm.
This was reported in coverity report 203523.

Fixes zephyrproject-rtos#18374

Additionally remove unneeded err initialization in main function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
galak pushed a commit that referenced this issue Aug 28, 2019
Error checking was missing following call to
counter_set_channel_alarm.
This was reported in coverity report 203523.

Fixes #18374

Additionally remove unneeded err initialization in main function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
LeiW000 pushed a commit to LeiW000/zephyr that referenced this issue Sep 2, 2019
Error checking was missing following call to
counter_set_channel_alarm.
This was reported in coverity report 203523.

Fixes zephyrproject-rtos#18374

Additionally remove unneeded err initialization in main function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Samples Samples bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants