Skip to content

[Coverity CID: 434580] Untrusted divisor in drivers/sensor/bosch/bmp180/bmp180.c #81967

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 Nov 25, 2024 · 4 comments
Assignees
Labels
area: Sensors Sensors 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/b1def7145fd/drivers/sensor/bosch/bmp180/bmp180.c

Category: Insecure data handling
Function: bmp180_press_channel_get
Component: Drivers
CID: 434580

Details:

https://github.com/zephyrproject-rtos/zephyr/blob/b1def7145fd/drivers/sensor/bosch/bmp180/bmp180.c#L350

Please fix or provide comments in coverity using the link:

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

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

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: Sensors Sensors 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 Nov 25, 2024
@MaureenHelm
Copy link
Member

@ruehlchris this came from #77182, can you take a look?

@ruehlchris
Copy link

@ruehlchris this came from #77182, can you take a look?

Yes, I will fix this.

@ruehlchris
Copy link

Hi @MaureenHelm ,

the check hit on this lines.
partial_data1 = (data->raw_temp - cal->ac6) * cal->ac5 / 0x8000;
partial_data2 = cal->mc * 0x800 / (partial_data1 + cal->md);

where partial_data1 + cal->md theoretically can be zero.

I will add a check that partial_data1 + cal->md != 0 and for the unlikely case set partial_data2 = 0

@zephyrbot
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors 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

3 participants