提交 9c8b3edd 编写于 作者: B Bob Copeland 提交者: John W. Linville

ath5k: avoid and warn on potential infinite loop

If we are trying to interpolate a curve with slope == 0, the return
value will always be the y-coordinate.  In this code we are looping
until we reach a minimum y-coordinate on a line, which in the 0-slope
case can never happen, thus the loop never terminates.

The PCDAC steps come from the EEPROM and should never be equal, but
we should gracefully handle that case, so warn and bail out.
Reported-by: NSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: NBob Copeland <me@bobcopeland.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 61405e97
...@@ -1897,6 +1897,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR, ...@@ -1897,6 +1897,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR,
s16 min_pwrL, min_pwrR; s16 min_pwrL, min_pwrR;
s16 pwr_i; s16 pwr_i;
if (WARN_ON(stepL[0] == stepL[1] || stepR[0] == stepR[1]))
return 0;
if (pwrL[0] == pwrL[1]) if (pwrL[0] == pwrL[1])
min_pwrL = pwrL[0]; min_pwrL = pwrL[0];
else { else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册