mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 20:10:17 +01:00
wext: avoid division by zero
Coverity is angry: CID 59367 (#1-3 of 3): Division or modulo by float zero (DIVIDE_BY_ZERO) 30. divide_by_zero: In expression ((double)max_level - (double)level) / ((double)max_level - (double)noise), division by expression (double)max_level - (double)noise which may be zero has undefined behavior.
This commit is contained in:
parent
9b85179840
commit
503b714f15
1 changed files with 1 additions and 1 deletions
|
|
@ -315,7 +315,7 @@ wext_qual_to_percent (const struct iw_quality *qual,
|
|||
noise = qual->noise - 0x100;
|
||||
else if ((max_qual->noise > 0) && !(max_qual->updated & IW_QUAL_NOISE_INVALID))
|
||||
noise = max_qual->noise - 0x100;
|
||||
noise = CLAMP (noise, FALLBACK_NOISE_FLOOR_DBM, FALLBACK_SIGNAL_MAX_DBM);
|
||||
noise = CLAMP (noise, FALLBACK_NOISE_FLOOR_DBM, FALLBACK_SIGNAL_MAX_DBM - 1);
|
||||
|
||||
/* A sort of signal-to-noise ratio calculation */
|
||||
level_percent = (int) (100 - 70 * (((double)max_level - (double)level) /
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue