aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2008-10-15 04:53:06 -0400
committerWim Van Sebroeck <wim@iguana.be>2008-10-15 04:53:06 -0400
commit7c2500f17d65092d93345f3996cf82ebca17e9ff (patch)
tree5d019244cf993839af05ea08cd0713ec1d1b390a /drivers/watchdog
parent278429cff8809958d25415ba0ed32b59866ab1a8 (diff)
[WATCHDOG] ib700wdt.c - fix buffer_underflow bug
This fixes Bug 11399: if ibwdt_set_heartbeat(int t) is called with value 30 then the check "if ((t < 0) || (t > 30))" in ibwdt_set_heartbeat is not going to fail because t == 30, but in the loop, the check wd_times[i] > t is never going to be true because none of the wd_times are greater than the value of t (i.e. 30). So we are exiting the loop with i == -1 and therefore setting wd_margin to -1 which is wrong. Reported-by: Zvonimir Rakamaric <zrakamar@cs.ubc.ca> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/ib700wdt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index 05a28106e8eb..8782ec1f5aa0 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -154,7 +154,7 @@ static int ibwdt_set_heartbeat(int t)
154 return -EINVAL; 154 return -EINVAL;
155 155
156 for (i = 0x0F; i > -1; i--) 156 for (i = 0x0F; i > -1; i--)
157 if (wd_times[i] > t) 157 if (wd_times[i] >= t)
158 break; 158 break;
159 wd_margin = i; 159 wd_margin = i;
160 return 0; 160 return 0;