mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: domen@coderock.org
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, isdn4linux@listserv.isdn4linux.de,
	domen@coderock.org, yrgrknmxpzlk@gawab.com
Subject: [patch 7/8] drivers/isdn/i4l/* - compile warning cleanup
Date: Sun, 06 Mar 2005 23:38:19 +0100	[thread overview]
Message-ID: <20050306223819.9A6F51EC90@trashy.coderock.org> (raw)


compile warning cleanup - handle copy_to/from_user error 
returns, initialize return value to reasonable number in case used before 
initialized.

Signed-off-by: Stephen Biggs <yrgrknmxpzlk@gawab.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/drivers/isdn/i4l/isdn_common.c |    6 +++++-
 kj-domen/drivers/isdn/i4l/isdn_ppp.c    |    3 ++-
 kj-domen/drivers/isdn/i4l/isdn_v110.c   |    2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff -puN drivers/isdn/i4l/isdn_common.c~return_code-drivers_isdn_i4l drivers/isdn/i4l/isdn_common.c
--- kj/drivers/isdn/i4l/isdn_common.c~return_code-drivers_isdn_i4l	2005-03-05 16:13:07.000000000 +0100
+++ kj-domen/drivers/isdn/i4l/isdn_common.c	2005-03-05 16:13:07.000000000 +0100
@@ -1843,8 +1843,12 @@ isdn_writebuf_stub(int drvidx, int chan,
 	if (!skb)
 		return 0;
 	skb_reserve(skb, hl);
-	copy_from_user(skb_put(skb, len), buf, len);
+	if (copy_from_user(skb_put(skb, len), buf, len)) {
+		ret = -EFAULT;
+		goto after_writebuf_skb;
+	}
 	ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, 1, skb);
+after_writebuf_skb:
 	if (ret <= 0)
 		dev_kfree_skb(skb);
 	if (ret > 0)
diff -puN drivers/isdn/i4l/isdn_ppp.c~return_code-drivers_isdn_i4l drivers/isdn/i4l/isdn_ppp.c
--- kj/drivers/isdn/i4l/isdn_ppp.c~return_code-drivers_isdn_i4l	2005-03-05 16:13:07.000000000 +0100
+++ kj-domen/drivers/isdn/i4l/isdn_ppp.c	2005-03-05 16:13:07.000000000 +0100
@@ -789,7 +789,8 @@ isdn_ppp_read(int min, struct file *file
 	is->first = b;
 
 	spin_unlock_irqrestore(&is->buflock, flags);
-	copy_to_user(buf, save_buf, count);
+	if (copy_to_user(buf, save_buf, count))
+		count = -EFAULT; /* make sure we free the save_buf */
 	kfree(save_buf);
 
 	return count;
diff -puN drivers/isdn/i4l/isdn_v110.c~return_code-drivers_isdn_i4l drivers/isdn/i4l/isdn_v110.c
--- kj/drivers/isdn/i4l/isdn_v110.c~return_code-drivers_isdn_i4l	2005-03-05 16:13:07.000000000 +0100
+++ kj-domen/drivers/isdn/i4l/isdn_v110.c	2005-03-05 16:13:07.000000000 +0100
@@ -520,7 +520,7 @@ isdn_v110_stat_callback(int idx, isdn_ct
 {
 	isdn_v110_stream *v = NULL;
 	int i;
-	int ret;
+	int ret = 0;
 
 	if (idx < 0)
 		return 0;
_

                 reply	other threads:[~2005-03-06 23:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050306223819.9A6F51EC90@trashy.coderock.org \
    --to=domen@coderock.org \
    --cc=akpm@osdl.org \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yrgrknmxpzlk@gawab.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®