<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Marcelo Tosatti &lt;marcelo.tosatti@cyclades.com&gt;

From: Romain Lievin &lt;romain@lievin.net&gt;


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.


---

 25-akpm/drivers/char/tipar.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff -puN drivers/char/tipar.c~tipar-div-by-zero-fix drivers/char/tipar.c
--- 25/drivers/char/tipar.c~tipar-div-by-zero-fix	2004-03-24 20:00:00.858506640 -0800
+++ 25-akpm/drivers/char/tipar.c	2004-03-24 20:00:43.853970336 -0800
@@ -67,7 +67,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "1.17"
+#define DRIVER_VERSION "1.19"
 #define DRIVER_AUTHOR  "Romain Lievin &lt;roms@lpg.ticalc.org&gt;"
 #define DRIVER_DESC    "Device driver for TI/PC parallel link cables"
 #define DRIVER_LICENSE "GPL"
@@ -361,10 +361,13 @@ tipar_ioctl(struct inode *inode, struct 
 
 	switch (cmd) {
 	case IOCTL_TIPAR_DELAY:
-	  delay = (int)arg;    //get_user(delay, &amp;arg);
-	  break;
+		delay = (int)arg;    //get_user(delay, &amp;arg);
+		break;
 	case IOCTL_TIPAR_TIMEOUT:
-	  timeout = (int)arg;  //get_user(timeout, &amp;arg);
+		if (arg != 0)
+                        timeout = (int)arg;
+                else
+                        retval = -EINVAL;
 	  break;
 	default:
 		retval = -ENOTTY;
@@ -399,7 +402,11 @@ tipar_setup(char *str)
 	str = get_options(str, ARRAY_SIZE(ints), ints);
 
 	if (ints[0] &gt; 0) {
-		timeout = ints[1];
+		if (ints[1] != 0)
+                        timeout = ints[1];
+                else
+                        printk(KERN_WARNING "tipar: wrong timeout value (0), "
+				"using default value instead.");
 		if (ints[0] &gt; 1) {
 			delay = ints[2];
 		}

_
</pre></body></html>