drivers: Changed return statement in function get_timeout()
According to the Coverity issue 188890 (github issue #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 <maxxliferobot@gmail.com>
This commit is contained in:
parent
630af8a65f
commit
039d8ecf6a
1 changed files with 1 additions and 1 deletions
|
@ -97,7 +97,7 @@ static u32_t get_timeout(u32_t timeout)
|
|||
count++;
|
||||
}
|
||||
|
||||
return count - 1;
|
||||
return ((count > 1U) ? (count - 1U) : 0);
|
||||
}
|
||||
|
||||
static int wdt_qmsi_install_timeout(struct device *dev,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue