From: Dipankar Sarma <dipankar@in.ibm.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Misc 2.5 Fixes: cp-user-zoran
Date: Tue, 10 Jun 2003 15:52:55 +0530 [thread overview]
Message-ID: <20030610102255.GL2194@in.ibm.com> (raw)
In-Reply-To: <20030610102024.GK2194@in.ibm.com>
Use copy_to_user/put_user with user buffers.
drivers/media/video/zoran_procfs.c | 6 +++++-
drivers/media/video/zr36120.c | 12 ++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff -puN drivers/media/video/zoran_procfs.c~cp-user-zoran drivers/media/video/zoran_procfs.c
--- linux-2.5.70-ds/drivers/media/video/zoran_procfs.c~cp-user-zoran 2003-06-08 04:10:38.000000000 +0530
+++ linux-2.5.70-ds-dipankar/drivers/media/video/zoran_procfs.c 2003-06-08 04:10:38.000000000 +0530
@@ -119,7 +119,11 @@ static int zoran_write_proc(struct file
printk(KERN_ERR "%s: write_proc: can not allocate memory\n", zr->name);
return -ENOMEM;
}
- memcpy(string, buffer, count);
+ if(copy_from_user(string, buffer, count))
+ {
+ vfree(string);
+ return -EFAULT;
+ }
string[count] = 0;
DEBUG2(printk(KERN_INFO "%s: write_proc: name=%s count=%lu data=%x\n", zr->name, file->f_dentry->d_name.name, count, (int) data));
ldelim = " \t\n";
diff -puN drivers/media/video/zr36120.c~cp-user-zoran drivers/media/video/zr36120.c
--- linux-2.5.70-ds/drivers/media/video/zr36120.c~cp-user-zoran 2003-06-08 04:10:38.000000000 +0530
+++ linux-2.5.70-ds-dipankar/drivers/media/video/zr36120.c 2003-06-08 04:10:38.000000000 +0530
@@ -1693,12 +1693,12 @@ long vbi_read(struct video_device* dev,
for (x=0; optr+1<eptr && x<-done->w; x++)
{
unsigned char a = iptr[x*2];
- *optr++ = a;
- *optr++ = a;
+ __put_user(a, optr++);
+ __put_user(a, optr++);
}
/* and clear the rest of the line */
for (x*=2; optr<eptr && x<done->bpl; x++)
- *optr++ = 0;
+ __put_user(0, optr++);
/* next line */
iptr += done->bpl;
}
@@ -1715,10 +1715,10 @@ long vbi_read(struct video_device* dev,
{
/* copy to doubled data to userland */
for (x=0; optr<eptr && x<-done->w; x++)
- *optr++ = iptr[x*2];
+ __put_user(iptr[x*2], optr++);
/* and clear the rest of the line */
for (;optr<eptr && x<done->bpl; x++)
- *optr++ = 0;
+ __put_user(0, optr++);
/* next line */
iptr += done->bpl;
}
@@ -1727,7 +1727,7 @@ long vbi_read(struct video_device* dev,
/* API compliance:
* place the framenumber (half fieldnr) in the last long
*/
- ((ulong*)eptr)[-1] = done->fieldnr/2;
+ __put_user(done->fieldnr/2, ((ulong*)eptr)-1);
}
/* keep the engine running */
_
next prev parent reply other threads:[~2003-06-10 10:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-10 10:05 Misc 2.5 Fixes: Summary Dipankar Sarma
2003-06-10 10:05 ` Joshua Kwan
2003-06-10 10:11 ` Joshua Kwan
2003-06-10 10:06 ` Misc 2.5 Fixes: arcnet-oops-fix Dipankar Sarma
2003-06-10 10:07 ` Misc 2.5 Fixes: x25-facilities-parse Dipankar Sarma
2003-06-10 10:09 ` Misc 2.5 Fixes: cp-user-awe Dipankar Sarma
2003-06-10 10:09 ` Misc 2.5 Fixes: cp-user-cmpci Dipankar Sarma
2003-06-10 10:10 ` Misc 2.5 Fixes: cp-user-eicon Dipankar Sarma
2003-06-10 10:11 ` Misc 2.5 Fixes: cp-user-intermezzo Dipankar Sarma
2003-06-10 10:13 ` Misc 2.5 Fixes: cp-user-mdc800 Dipankar Sarma
2003-06-10 10:15 ` Misc 2.5 Fixes: cp-user-mpu401 Dipankar Sarma
2003-06-10 10:18 ` Misc 2.5 Fixes: cp-user-sisfb Dipankar Sarma
2003-06-10 10:20 ` Misc 2.5 Fixes: cp-user-vicam Dipankar Sarma
2003-06-10 10:22 ` Dipankar Sarma [this message]
2003-06-10 10:23 ` Misc 2.5 Fixes: mem-leak-emu10k1 Dipankar Sarma
2003-06-10 10:24 ` Misc 2.5 Fixes: mem-leak-rio Dipankar Sarma
2003-06-10 10:25 ` Misc 2.5 Fixes: resrc-leak-i810 Dipankar Sarma
2003-06-10 14:53 ` Misc 2.5 Fixes: cp-user-zoran Hollis Blanchard
2003-06-11 10:48 ` Misc 2.5 Fixes: cp-user-vicam Dipankar Sarma
2003-06-11 12:18 ` Alan Cox
2003-06-11 12:38 ` Dipankar Sarma
2003-06-10 16:31 ` Misc 2.5 Fixes: cp-user-sisfb Thomas Winischhofer
2003-06-10 17:34 ` Dipankar Sarma
2003-06-10 18:29 ` James Simmons
2003-06-10 14:38 ` Misc 2.5 Fixes: cp-user-cmpci Hollis Blanchard
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=20030610102255.GL2194@in.ibm.com \
--to=dipankar@in.ibm.com \
--cc=akpm@digeo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox