commit | 4c2ef8f4d14ca411b41b9c6891028d58d2079bf7 | [log] [tgz] |
---|---|---|
author | David Gibson <david@gibson.dropbear.id.au> | Tue Jun 08 15:17:11 2021 +1000 |
committer | David Gibson <david@gibson.dropbear.id.au> | Tue Jun 08 15:17:11 2021 +1000 |
tree | 620618e13ceda692202d9ae02ddfae0488a68a93 | |
parent | e59ca36fb70e32f8b4850135ab94fdf44cd22557 [diff] |
checks: Introduce is_multiple_of() In a number of places we check if one number is a multiple of another, using a modulus. In some of those cases the divisor is potentially zero, which needs special handling or we could trigger a divide by zero. Introduce an is_multiple_of() helper to safely handle this case, and use it in a bunch of places. This should close Coverity issue 1501687, maybe others as well. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>