Skip to content

Commit

Permalink
[WATCHDOG] ib700wdt.c - fix buffer_underflow bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wim Van Sebroeck committed Oct 15, 2008
1 parent 278429c commit 7c2500f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/watchdog/ib700wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int ibwdt_set_heartbeat(int t)
return -EINVAL;

for (i = 0x0F; i > -1; i--)
if (wd_times[i] > t)
if (wd_times[i] >= t)
break;
wd_margin = i;
return 0;
Expand Down

0 comments on commit 7c2500f

Please sign in to comment.