mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karsten Keil <kkeil@suse.de>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Karsten Keil <kkeil@suse.de>,
	Kai Germaschewski <kai.germaschewski@gmx.de>,
	isdn4linux@listserv.isdn4linux.de
Subject: Re: [PATCH] ISDN: fix copy_to_user() unused result warning in isdn_ppp
Date: Wed, 22 Feb 2006 00:03:46 +0100	[thread overview]
Message-ID: <20060221230346.GA17973@pingi.kke.suse.de> (raw)
In-Reply-To: <200602212314.15362.jesper.juhl@gmail.com>

On Tue, Feb 21, 2006 at 11:14:15PM +0100, Jesper Juhl wrote:
> From: Jesper Juhl <jesper.juhl@gmail.com>
> 
> 
> Fix compile warning about copy_to_user() unused result in isdn_ppp.c
>    drivers/isdn/i4l/isdn_ppp.c:785: warning: ignoring return value of `copy_to_user', declared with attribute warn_unused_result
> 
> 
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> 
> ---
> 
>  drivers/isdn/i4l/isdn_ppp.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletion(-)
> 
> --- linux-2.6.16-rc4-mm1-orig/drivers/isdn/i4l/isdn_ppp.c	2006-01-03 04:21:10.000000000 +0100
> +++ linux-2.6.16-rc4-mm1/drivers/isdn/i4l/isdn_ppp.c	2006-02-21 23:07:57.000000000 +0100
> @@ -782,7 +782,10 @@ 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)) {
> +		kfree(save_buf);
> +		return -EFAULT;
> +	}
>  	kfree(save_buf);
>  
>  	return count;

What about:

--- linux-2.6.16-rc4-mm1-orig/drivers/isdn/i4l/isdn_ppp.c     2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.16-rc4-mm1/drivers/isdn/i4l/isdn_ppp.c  2006-02-21 23:07:57.000000000 +0100
@@ -782,7 +782,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;
 	kfree(save_buf);
 
 	return count;

should result in a conditional move instead of jumps.

But I'm OK with the original patch as well, for both version you can add

Signed-off-by: Karsten Keil <kkeil@suse.de>

-- 
Karsten Keil
SuSE Labs
ISDN development

  reply	other threads:[~2006-02-21 23:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21 22:14 Jesper Juhl
2006-02-21 23:03 ` Karsten Keil [this message]
2006-02-21 23:07   ` Jesper Juhl

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=20060221230346.GA17973@pingi.kke.suse.de \
    --to=kkeil@suse.de \
    --cc=akpm@osdl.org \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=jesper.juhl@gmail.com \
    --cc=kai.germaschewski@gmx.de \
    --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 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®