Trivial bugfix in tipar
PATCH 1/1 Trivial bugfix in tipar
Hi !
This small patch for drivers/char/tipar.c fixes a divide-by-zero error when you try to read/write data after setting the timeout to 0. Please apply,
Seb
usr/src/linux/drivers/char/tipar.c Sat Mar 20 14:06:53 2004 renamed from tipar.c Sat Mar 20 13:48:55 2004 +1 -1
@@ -364,7 +364,7 @@ delay = (int)arg; //get_user(delay, &arg); break; case IOCTL_TIPAR_TIMEOUT: - timeout = (int)arg; //get_user(timeout, &arg); + if (arg != 0) timeout = (int)arg; else retval = -EINVAL; //
get_user(timeout, &arg);
break;
default:
retval = -ENOTTY;
@@ -399,7 +399,7 @@
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] > 0) {
- timeout = ints[1];
+ if (ints[1] != 0) timeout = ints[1]; else printk("tipar: wrong
timeout value (0), using default value");
if (ints[0] > 1) {
delay = ints[2];
}