Skip to content

[Coverity CID :195871]Integer handling issues in /drivers/counter/counter_ll_stm32_rtc.c #14397

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

Closed
aasthagr opened this issue Mar 12, 2019 · 7 comments
Assignees
Labels
area: Counter 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: medium Medium impact/importance bug

Comments

@aasthagr
Copy link
Collaborator

Static code scan issues seen in File: /drivers/counter/counter_ll_stm32_rtc.c
Category: Integer handling issues
Function: rtc_stm32_read
Component: Drivers
CID: 195871
Please fix or provide comments to square it off in coverity in the link: https://scan9.coverity.com/reports.htm#v32951/p12996

@galak galak added Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug labels Mar 12, 2019
@galak galak added area: Counter platform: STM32 ST Micro STM32 bug The issue is a bug, or the PR is fixing a bug and removed bug The issue is a bug, or the PR is fixing a bug labels Mar 12, 2019
@erwango
Copy link
Member

erwango commented Mar 15, 2019

Cf analysis in #14415.
Will be fixed when upgrading SDK to 0.10.0.

@erwango erwango closed this as completed Mar 21, 2019
@ceolin
Copy link
Member

ceolin commented Mar 21, 2019

@erwango actually coverity spot this problem even with latest sdk. Question, why don't you cast this way:

ticks = counter_us_to_ticks(dev, (u64_t)ts * USEC_PER_SEC);

Here the we ensure that the multiplication won't overflow

@ceolin
Copy link
Member

ceolin commented Mar 21, 2019

actually you don't need the cast at all, ts is time_t

@ceolin
Copy link
Member

ceolin commented Mar 21, 2019

#14799

@ceolin ceolin reopened this Mar 21, 2019
@erwango
Copy link
Member

erwango commented Mar 22, 2019

@ceolin , cf my comment in #14799, none of the proposal works actually.

@galak
Copy link
Collaborator

galak commented Mar 26, 2019

Can we close this now?

@erwango
Copy link
Member

erwango commented Mar 27, 2019

Fixed by #14799

@erwango erwango closed this as completed Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Counter 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: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants