Skip to content

[Coverity CID: 444379] Macro compares unsigned to 0 in drivers/mfd/mfd_npm2100.c #84782

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
zephyrbot opened this issue Jan 28, 2025 · 2 comments
Assignees
Labels
area: MFD bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug

Comments

@zephyrbot
Copy link
Collaborator

Static code scan issues found in file:

https://github.com/zephyrproject-rtos/zephyr/tree/f0d0264c057255c60e91e422406f47a7b87d8a8a/drivers/mfd/mfd_npm2100.c

Category: Integer handling issues
Function: mfd_npm2100_set_timer
Component: Drivers
CID: 444379

Details:

uint32_t ticks = (uint32_t)DIV_ROUND_CLOSEST(((uint64_t)time_ms * TIMER_PRESCALER_MUL),

Please fix or provide comments in coverity using the link:

https://scan9.scan.coverity.com/#/project-view/29271/12996?selectedIssue=444379

For more information about the violation, check the Coverity Reference. (CWE-570)

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 MAINTAINERS file.

@zephyrbot zephyrbot added area: MFD bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug labels Jan 28, 2025
@gmarull
Copy link
Member

gmarull commented Feb 3, 2025

@seov-nordic

seov-nordic added a commit to seov-nordic/zephyr that referenced this issue Feb 4, 2025
A -1 was missing from the timer value calculation. In addition,
DIV_ROUND_CLOSEST was replaced with a custom macro fixing zephyrproject-rtos#84782.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
kartben pushed a commit that referenced this issue May 27, 2025
A -1 was missing from the timer value calculation. In addition,
DIV_ROUND_CLOSEST was replaced with a custom macro fixing #84782.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
@zephyrbot
Copy link
Collaborator Author

This coverity CID is not in the outstanding issues anymore, code might have changed or issue was resolved.

Shreyas-Shankar155 pushed a commit to MihiraMadhava/zephyr that referenced this issue Jun 3, 2025
A -1 was missing from the timer value calculation. In addition,
DIV_ROUND_CLOSEST was replaced with a custom macro fixing zephyrproject-rtos#84782.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: MFD bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants