Skip to content

[Coverity CID :189509]Integer handling issues in /drivers/sensor/ms5837/ms5837.c #11097

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
mandarcthorat1 opened this issue Nov 5, 2018 · 4 comments
Assignees
Labels
area: Drivers 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

@mandarcthorat1
Copy link
Contributor

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

@mandarcthorat1 mandarcthorat1 added area: Drivers bug The issue is a bug, or the PR is fixing a bug Coverity A Coverity detected issue or its fix labels Nov 5, 2018
@vanwinkeljan
Copy link
Member

requested access to zephyr coverity project for further investigation

@vanwinkeljan vanwinkeljan self-assigned this Nov 5, 2018
@vanwinkeljan
Copy link
Member

Coverity reported possible overflow at line 74 in ms5837.c:

	temp_sq = (data->temperature - 2000) * (data->temperature - 2000);

But as per MS5837 datasheet the maximum value of data->temperature is 8500 and the minimum value is -4000 as such no overflow can occur.

@vanwinkeljan
Copy link
Member

@agross-linaro, @ceolin could your mark the coverity issue as intentional?

@galak galak added the priority: medium Medium impact/importance bug label Nov 21, 2018
@ceolin
Copy link
Member

ceolin commented Dec 12, 2018

@vanwinkeljan done, thanks !

@ceolin ceolin closed this as completed Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Drivers 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

5 participants