[WATCHDOG] v2.6.28-rc1 watchdog patches - part 2

From: Wim Van Sebroeck
Date: Thu Oct 16 2008 - 13:32:44 EST

Hi Linus,

Please pull from 'master' branch of
or if master.kernel.org hasn't synced up yet:

This will update the following files:

drivers/watchdog/ib700wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

with these Changes:

Author: Wim Van Sebroeck <wim@xxxxxxxxx>
Date: Wed Oct 15 08:53:06 2008 +0000

[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@xxxxxxxxx>
Signed-off-by: Wim Van Sebroeck <wim@xxxxxxxxx>

The Changes can also be looked at on:

For completeness, I added the overal diff below.


diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index 05a2810..8782ec1 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -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)
wd_margin = i;
return 0;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/