* [PATCH] ISDN: fix copy_to_user() unused result warning in isdn_ppp
@ 2006-02-21 22:14 Jesper Juhl
2006-02-21 23:03 ` Karsten Keil
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2006-02-21 22:14 UTC (permalink / raw)
To: linux-kernel
Cc: Andrew Morton, Karsten Keil, Kai Germaschewski, isdn4linux, Jesper Juhl
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;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ISDN: fix copy_to_user() unused result warning in isdn_ppp 2006-02-21 22:14 [PATCH] ISDN: fix copy_to_user() unused result warning in isdn_ppp Jesper Juhl @ 2006-02-21 23:03 ` Karsten Keil 2006-02-21 23:07 ` Jesper Juhl 0 siblings, 1 reply; 3+ messages in thread From: Karsten Keil @ 2006-02-21 23:03 UTC (permalink / raw) To: Jesper Juhl Cc: linux-kernel, Andrew Morton, Karsten Keil, Kai Germaschewski, isdn4linux 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ISDN: fix copy_to_user() unused result warning in isdn_ppp 2006-02-21 23:03 ` Karsten Keil @ 2006-02-21 23:07 ` Jesper Juhl 0 siblings, 0 replies; 3+ messages in thread From: Jesper Juhl @ 2006-02-21 23:07 UTC (permalink / raw) To: Jesper Juhl, linux-kernel, Andrew Morton, Karsten Keil, Kai Germaschewski, isdn4linux On 2/22/06, Karsten Keil <kkeil@suse.de> wrote: > 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. > I actually considered that, but decided against it since I thought it would be confusing use / misuse of 'count'. Either version is fine by me. It's not likely to get hit in any case due to the verify_area() call further up in the code. > But I'm OK with the original patch as well, for both version you can add > > Signed-off-by: Karsten Keil <kkeil@suse.de> > Thanks. Andrew: could you please apply either my or Karsten's version to -mm ? -- Jesper Juhl <jesper.juhl@gmail.com> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-21 23:07 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-02-21 22:14 [PATCH] ISDN: fix copy_to_user() unused result warning in isdn_ppp Jesper Juhl 2006-02-21 23:03 ` Karsten Keil 2006-02-21 23:07 ` Jesper Juhl
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®