public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tipar char driver (divide by zero)
@ 2004-03-21 21:28 Romain Lievin
  2004-03-26 22:26 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Lievin @ 2004-03-21 21:28 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: greg, sebastien.bourdeauducq

Hi Greg,

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.

I got it to make a patch to apply against kernel 2.4 and 2.6.
Please apply.

Thanks, Romain.
=================================[cut here]============================
diff -Naur linux-2.4.23/drivers/char/tipar.c linux/drivers/char/tipar.c
--- linux-2.4.23/drivers/char/tipar.c	2003-06-01 05:06:24.000000000 +0200
+++ linux/drivers/char/tipar.c	2004-03-21 22:19:54.000000000 +0100
@@ -66,7 +66,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "1.18"
+#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,11 +364,14 @@
 
 	switch (cmd) {
 	case IOCTL_TIPAR_DELAY:
-	  delay = (int)arg;    //get_user(delay, &arg);
-	  break;
+		delay = (int)arg;    //get_user(delay, &arg);
+		break;
 	case IOCTL_TIPAR_TIMEOUT:
-	  timeout = (int)arg;  //get_user(timeout, &arg);
-	  break;
+		if (arg != 0)
+                        timeout = (int)arg;
+                else
+                        retval = -EINVAL;
+		break;
 	default:
 		retval = -ENOTTY;
 		break;
@@ -402,7 +405,10 @@
 	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 instead.");
 		if (ints[0] > 1) {
 			delay = ints[2];
 		}

=================================[cut here]=============================
diff -Naur linux-2.6.3/drivers/char/tipar.c linux/drivers/char/tipar.c
--- linux-2.6.3/drivers/char/tipar.c	2004-02-18 04:58:48.000000000 +0100
+++ linux/drivers/char/tipar.c	2004-03-21 22:11:11.000000000 +0100
@@ -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"
@@ -361,10 +361,13 @@
 
 	switch (cmd) {
 	case IOCTL_TIPAR_DELAY:
-	  delay = (int)arg;    //get_user(delay, &arg);
-	  break;
+		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 @@
 	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 instead.");
 		if (ints[0] > 1) {
 			delay = ints[2];
 		}

-- 
Romain Liévin (roms):         <romain@lievin.net>
Web site:                     http://www.lievin.net
"Linux, y'a moins bien mais c'est plus cher !"







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tipar char driver (divide by zero)
  2004-03-21 21:28 [PATCH] tipar char driver (divide by zero) Romain Lievin
@ 2004-03-26 22:26 ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-03-26 22:26 UTC (permalink / raw)
  To: Romain Lievin; +Cc: Linux Kernel Mailing List, sebastien.bourdeauducq

On Sun, Mar 21, 2004 at 10:28:12PM +0100, Romain Lievin wrote:
> Hi Greg,
> 
> 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.
> 
> I got it to make a patch to apply against kernel 2.4 and 2.6.
> Please apply.

Thanks, I've applied the 2.6 version and will send it on.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] tipar char driver (divide by zero)
@ 2004-04-16  6:26 Romain Lievin
  2004-04-22 21:35 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Lievin @ 2004-04-16  6:26 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Greg KH

Hi,

a set of 2 patches (2.4 & 2.6) about the tipar.c char driver. It fixes a divide-by-zero error when we try to read/write data after setting timeout to 0.

Please apply...

Romain.
============================[cut here]==========================
diff -Naur linux-2.4.23/drivers/char/tipar.c linux/drivers/char/tipar.c
--- linux-2.4.23/drivers/char/tipar.c	2003-06-01 05:06:24.000000000 +0200
+++ linux/drivers/char/tipar.c	2004-03-21 22:19:54.000000000 +0100
@@ -66,7 +66,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "1.18"
+#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,11 +364,14 @@
 
 	switch (cmd) {
 	case IOCTL_TIPAR_DELAY:
-	  delay = (int)arg;    //get_user(delay, &arg);
-	  break;
+		delay = (int)arg;    //get_user(delay, &arg);
+		break;
 	case IOCTL_TIPAR_TIMEOUT:
-	  timeout = (int)arg;  //get_user(timeout, &arg);
-	  break;
+		if (arg != 0)
+                        timeout = (int)arg;
+                else
+                        retval = -EINVAL;
+		break;
 	default:
 		retval = -ENOTTY;
 		break;
@@ -402,7 +405,10 @@
 	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 instead.");
 		if (ints[0] > 1) {
 			delay = ints[2];
 		}

============================[cut here]==========================
diff -Naur linux-2.6.3/drivers/char/tipar.c linux/drivers/char/tipar.c
--- linux-2.6.3/drivers/char/tipar.c	2004-02-18 04:58:48.000000000 +0100
+++ linux/drivers/char/tipar.c	2004-03-21 22:11:11.000000000 +0100
@@ -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"
@@ -361,10 +361,13 @@
 
 	switch (cmd) {
 	case IOCTL_TIPAR_DELAY:
-	  delay = (int)arg;    //get_user(delay, &arg);
-	  break;
+		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 @@
 	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 instead.");
 		if (ints[0] > 1) {
 			delay = ints[2];
 		}

-- 
Romain Liévin (roms):         <romain@lievin.net>
Web site:                     http://www.lievin.net
"Linux, y'a moins bien mais c'est plus cher !"







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tipar char driver (divide by zero)
  2004-04-16  6:26 Romain Lievin
@ 2004-04-22 21:35 ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-04-22 21:35 UTC (permalink / raw)
  To: Romain Lievin; +Cc: Linux Kernel Mailing List

On Fri, Apr 16, 2004 at 08:26:35AM +0200, Romain Lievin wrote:
> Hi,
> 
> a set of 2 patches (2.4 & 2.6) about the tipar.c char driver. It fixes
> a divide-by-zero error when we try to read/write data after setting
> timeout to 0.
> 
> Please apply...

Applied to 2.6, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-22 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-21 21:28 [PATCH] tipar char driver (divide by zero) Romain Lievin
2004-03-26 22:26 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2004-04-16  6:26 Romain Lievin
2004-04-22 21:35 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox