Skip to content

drivers: Changed return statement in function get_timeout() #13597

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

Merged
merged 1 commit into from
Mar 3, 2019

Conversation

maxxlife
Copy link
Contributor

@maxxlife maxxlife commented Feb 20, 2019

Fix for overflowed or truncated value count-1U used as return value.
I decided to use a saturating subtract to avoid a vulnerability.
It will always return 0 or bigger value according to the conditions.
Now if count value is 0, function will return 0, not -1 as before.

Coverity-CID: 188890
Fixes: #10750

Signed-off-by: Masalski Maksim [email protected]

@maxxlife maxxlife requested a review from nashif as a code owner February 20, 2019 21:18
@zephyrbot
Copy link
Collaborator

zephyrbot commented Feb 20, 2019

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

@maxxlife maxxlife force-pushed the coverity-fix-188890 branch 8 times, most recently from 9e488ed to 75554b3 Compare February 20, 2019 22:35
@codecov-io
Copy link

codecov-io commented Feb 20, 2019

Codecov Report

Merging #13597 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #13597   +/-   ##
=======================================
  Coverage   52.45%   52.45%           
=======================================
  Files         322      322           
  Lines       46592    46592           
  Branches    10768    10768           
=======================================
  Hits        24442    24442           
  Misses      17247    17247           
  Partials     4903     4903

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 794d382...cf17643. Read the comment docs.

@maxxlife maxxlife force-pushed the coverity-fix-188890 branch 4 times, most recently from 53f6c60 to e9ed3b7 Compare February 21, 2019 08:17
@maxxlife maxxlife requested a review from rveerama1 as a code owner February 21, 2019 08:17
According to the Coverity issue 188890 (github issue zephyrproject-rtos#10705)
Fix for overflowed or truncated value  count-1U used as return value.
I decided to use a saturating subtract to avoid a vulnerability.
It will always return 0 or bigger value according to the conditions.
Now if count value is 0, function will return 0, not -1 as before.

Signed-off-by: Maksim Masalski <[email protected]>
@maxxlife maxxlife force-pushed the coverity-fix-188890 branch from e9ed3b7 to cf17643 Compare February 21, 2019 08:24
@nashif nashif merged commit 039d8ec into zephyrproject-rtos:master Mar 3, 2019
@maxxlife maxxlife deleted the coverity-fix-188890 branch May 2, 2019 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants