Skip to contentSkip to conversation

PATCH: drivers/staging/lirc/lirc_serial.c: use IS_ERR()

PATCH Mark Lord 2 participants 4 messages Feb 6, 2011 – Feb 9, 2011 Staging

lore
Share & tools
lore

Mark Lord

author
#0 lore raw

The lirc_serial.c module has never worked with ordinary homebrew serial blaster hardware, and leaks memory when this is attempted.

Fix it by replacing incorrect usage of PTR_ERR() with IS_ERR(). (patch is inline and also attached to bypass mailer issues).

--- linux-2.6.37/drivers/staging/lirc/lirc_serial.c 2011-01-04
19:50:19.000000000 -0500
+++ linux/drivers/staging/lirc/lirc_serial.c 2011-02-06 15:33:49.854453928 -0500
@@ -966,7 +966,7 @@
if (n % sizeof(int) || count % 2 == 0)
return -EINVAL;
wbuf = memdup_user(buf, n);
- if (PTR_ERR(wbuf))
+ if (IS_ERR(wbuf))
return PTR_ERR(wbuf);
spin_lock_irqsave(&hardware[type].lock, flags); if (type == LIRC_IRDEO) {

drivers/staging/lirc/lirc_serial.c renamed from drivers/staging/lirc/lirc_serial.c.orig +1 -1
@@ -966,7 +966,7 @@
 	if (n % sizeof(int) || count % 2 == 0)
 		return -EINVAL;
 	wbuf = memdup_user(buf, n);
-	if (PTR_ERR(wbuf))
+	if (IS_ERR(wbuf))
 		return PTR_ERR(wbuf);
 	spin_lock_irqsave(&hardware[type].lock, flags);
 	if (type == LIRC_IRDEO) {
author
#1 lore raw
Quoted 12 lines · Mark Lord

The lirc_serial.c module has never worked with ordinary homebrew serial blaster hardware, and leaks memory when this is attempted.

Fix it by replacing incorrect usage of PTR_ERR() with IS_ERR(). (patch is inline and also attached to bypass mailer issues).

--- linux-2.6.37/drivers/staging/lirc/lirc_serial.c 2011-01-04
19:50:19.000000000 -0500
+++ linux/drivers/staging/lirc/lirc_serial.c 2011-02-06 15:33:49.854453928 -0500

Review line 972

Quoted 8 lines
(quoted diff) +1 -1
@@ -966,7 +966,7 @@
 	if (n % sizeof(int) || count % 2 == 0)
 		return -EINVAL;
 	wbuf = memdup_user(buf, n);
-	if (PTR_ERR(wbuf))
+	if (IS_ERR(wbuf))
 		return PTR_ERR(wbuf);
 	spin_lock_irqsave(&hardware[type].lock, flags);
 	if (type == LIRC_IRDEO) {

Anyone out there?

Greg?

drivers/staging/lirc/lirc_serial.c renamed from drivers/staging/lirc/lirc_serial.c.orig +1 -1
@@ -966,7 +966,7 @@
 	if (n % sizeof(int) || count % 2 == 0)
 		return -EINVAL;
 	wbuf = memdup_user(buf, n);
-	if (PTR_ERR(wbuf))
+	if (IS_ERR(wbuf))
 		return PTR_ERR(wbuf);
 	spin_lock_irqsave(&hardware[type].lock, flags);
 	if (type == LIRC_IRDEO) {
#2 lore raw
Quoted 25 lines · Mark Lord
Quoted 12 lines · Mark Lord

The lirc_serial.c module has never worked with ordinary homebrew serial blaster hardware, and leaks memory when this is attempted.

Fix it by replacing incorrect usage of PTR_ERR() with IS_ERR(). (patch is inline and also attached to bypass mailer issues).

--- linux-2.6.37/drivers/staging/lirc/lirc_serial.c 2011-01-04
19:50:19.000000000 -0500
+++ linux/drivers/staging/lirc/lirc_serial.c 2011-02-06 15:33:49.854453928 -0500

drivers/staging/lirc/lirc_serial.c line 972

Quoted 8 lines
drivers/staging/lirc/lirc_serial.c renamed from drivers/staging/lirc/lirc_serial.c.orig +1 -1
@@ -966,7 +966,7 @@
 	if (n % sizeof(int) || count % 2 == 0)
 		return -EINVAL;
 	wbuf = memdup_user(buf, n);
-	if (PTR_ERR(wbuf))
+	if (IS_ERR(wbuf))
 		return PTR_ERR(wbuf);
 	spin_lock_irqsave(&hardware[type].lock, flags);
 	if (type == LIRC_IRDEO) {

Anyone out there?

Quoted 1 line

Greg?

Patience please, I just got over the flu and am now catching up on patches. I'll go queue this up now.

thanks,

greg k-h

#3 lore raw
Quoted 26 lines · Greg KH
Quoted 25 lines · Mark Lord
Quoted 12 lines · Mark Lord

The lirc_serial.c module has never worked with ordinary homebrew serial blaster hardware, and leaks memory when this is attempted.

Fix it by replacing incorrect usage of PTR_ERR() with IS_ERR(). (patch is inline and also attached to bypass mailer issues).

--- linux-2.6.37/drivers/staging/lirc/lirc_serial.c 2011-01-04
19:50:19.000000000 -0500
+++ linux/drivers/staging/lirc/lirc_serial.c 2011-02-06 15:33:49.854453928 -0500

drivers/staging/lirc/lirc_serial.c line 972

Quoted 8 lines
drivers/staging/lirc/lirc_serial.c renamed from drivers/staging/lirc/lirc_serial.c.orig +1 -1
@@ -966,7 +966,7 @@
 	if (n % sizeof(int) || count % 2 == 0)
 		return -EINVAL;
 	wbuf = memdup_user(buf, n);
-	if (PTR_ERR(wbuf))
+	if (IS_ERR(wbuf))
 		return PTR_ERR(wbuf);
 	spin_lock_irqsave(&hardware[type].lock, flags);
 	if (type == LIRC_IRDEO) {

Anyone out there?

Quoted 4 lines
Quoted 1 line

Greg?

Patience please, I just got over the flu and am now catching up on patches. I'll go queue this up now.

Actually, it's already fixed in the current tree thanks to Jarod in commit 88914bdf8c677ebd7e797adac05e47303fd6ac77 so you shouldn't need to worry about this anymore.

thanks,

greg k-h