summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-05-02 13:37:13 +0000
committerMichael Hunold <devnull@localhost>2003-05-02 13:37:13 +0000
commit9e186cfe40c16ae35e15185b38663deb5b1bc17d (patch)
treef3678a65497cc2b45bc472f00152efa1f30817c4
parent4bdbd31d1ae35244fc58d39fc00f31e18599c782 (diff)
downloadmediapointer-dvb-s2-9e186cfe40c16ae35e15185b38663deb5b1bc17d.tar.gz
mediapointer-dvb-s2-9e186cfe40c16ae35e15185b38663deb5b1bc17d.tar.bz2
Replace simple memcpy() from user buffer by copy_from_user() construction.
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110_ir.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110_ir.c b/linux/drivers/media/dvb/ttpci/av7110_ir.c
index de1efcd24..3c4a30b8d 100644
--- a/linux/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/linux/drivers/media/dvb/ttpci/av7110_ir.c
@@ -148,11 +148,26 @@ static
int av7110_ir_write_proc (struct file *file, const char *buffer,
unsigned long count, void *data)
{
- if (count < 4 + 256 * sizeof(u16))
+ char *page;
+ int size = 4 + 256 * sizeof(u16);
+
+ if (count < size)
return -EINVAL;
+
+ page = (char *)vmalloc(size);
+ if( NULL == page ) {
+ return -ENOMEM;
+ }
- memcpy (&ir_config, buffer, 4);
- memcpy (&key_map, buffer + 4, 256 * sizeof(u16));
+ if (copy_from_user(page, buffer, size)) {
+ vfree(page);
+ return -EFAULT;
+ }
+
+ memcpy (&ir_config, page, 4);
+ memcpy (&key_map, page + 4, 256 * sizeof(u16));
+
+ vfree(page);
av7110_setup_irc_config (NULL, ir_config);