All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <kernel@teksavvy.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>,
	Jarod Wilson <jarod@wilsonet.com>,
	Greg Kroah-Hartman <greg@kroah.com>
Subject: PATCH: drivers/staging/lirc/lirc_serial.c: use IS_ERR()
Date: Sun, 06 Feb 2011 15:39:29 -0500	[thread overview]
Message-ID: <4D4F0701.5060602@teksavvy.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

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).

Signed-off-by: Mark Lord <mlord@pobox.com>

--- 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) {

[-- Attachment #2: lirc_serial_fix.patch --]
[-- Type: text/x-patch, Size: 428 bytes --]

--- linux-2.6.37/drivers/staging/lirc/lirc_serial.c.orig	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) {

             reply	other threads:[~2011-02-06 20:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06 20:39 Mark Lord [this message]
2011-02-08 21:34 ` PATCH: drivers/staging/lirc/lirc_serial.c: use IS_ERR() Mark Lord
2011-02-09 19:52   ` Greg KH
2011-02-09 19:54     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D4F0701.5060602@teksavvy.com \
    --to=kernel@teksavvy.com \
    --cc=greg@kroah.com \
    --cc=jarod@wilsonet.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.