Commit 100a165d authored by Romain Liévin's avatar Romain Liévin Committed by Greg Kroah-Hartman

[PATCH] tipar char driver (divide by zero)

A patch about the tipar.c char driver has been sent on lkml by Sebastien
Bourdeau. It fixes a divide-by-zero error when we try to read/write data
after setting the timeout to 0.
parent 1e5467ae
......@@ -67,7 +67,7 @@
/*
* Version Information
*/
#define DRIVER_VERSION "1.17"
#define DRIVER_VERSION "1.19"
#define DRIVER_AUTHOR "Romain Lievin <roms@lpg.ticalc.org>"
#define DRIVER_DESC "Device driver for TI/PC parallel link cables"
#define DRIVER_LICENSE "GPL"
......@@ -364,7 +364,10 @@ tipar_ioctl(struct inode *inode, struct file *file,
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;
break;
default:
retval = -ENOTTY;
......@@ -399,7 +402,10 @@ tipar_setup(char *str)
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] > 0) {
if (ints[1] != 0)
timeout = ints[1];
else
printk("tipar: wrong timeout value (0), using default value instead.");
if (ints[0] > 1) {
delay = ints[2];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment