Commit 66ebd50b authored by Linus Torvalds's avatar Linus Torvalds

Merge http://kernel-acme.bkbits.net:8080/intermezzo-copy_tofrom_user-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 10e3215f 280067b0
...@@ -105,9 +105,8 @@ int presto_set_ext_attr(struct inode *inode, ...@@ -105,9 +105,8 @@ int presto_set_ext_attr(struct inode *inode,
printk("InterMezzo: out of memory!!!\n"); printk("InterMezzo: out of memory!!!\n");
return -ENOMEM; return -ENOMEM;
} }
error = copy_from_user(buf, buffer, buffer_len); if (copy_from_user(buf, buffer, buffer_len))
if (error) return -EFAULT;
return error;
} else } else
buf = buffer; buf = buffer;
} else } else
......
...@@ -31,10 +31,9 @@ int begin_kml_reint (struct file *file, unsigned long arg) ...@@ -31,10 +31,9 @@ int begin_kml_reint (struct file *file, unsigned long arg)
ENTRY; ENTRY;
/* allocate buffer & copy it to kernel space */ /* allocate buffer & copy it to kernel space */
error = copy_from_user(&input, (char *)arg, sizeof(input)); if (copy_from_user(&input, (char *)arg, sizeof(input))) {
if ( error ) {
EXIT; EXIT;
return error; return -EFAULT;
} }
if (input.reclen > kml_fsdata->kml_maxsize) if (input.reclen > kml_fsdata->kml_maxsize)
...@@ -45,11 +44,10 @@ int begin_kml_reint (struct file *file, unsigned long arg) ...@@ -45,11 +44,10 @@ int begin_kml_reint (struct file *file, unsigned long arg)
EXIT; EXIT;
return -ENOMEM; return -ENOMEM;
} }
error = copy_from_user(path, input.volname, input.namelen); if (copy_from_user(path, input.volname, input.namelen)) {
if ( error ) {
PRESTO_FREE(path, input.namelen + 1); PRESTO_FREE(path, input.namelen + 1);
EXIT; EXIT;
return error; return -EFAULT;
} }
path[input.namelen] = '\0'; path[input.namelen] = '\0';
fset = kml_getfset (path); fset = kml_getfset (path);
...@@ -57,10 +55,9 @@ int begin_kml_reint (struct file *file, unsigned long arg) ...@@ -57,10 +55,9 @@ int begin_kml_reint (struct file *file, unsigned long arg)
kml_fsdata = FSET_GET_KMLDATA(fset); kml_fsdata = FSET_GET_KMLDATA(fset);
/* read the buf from user memory here */ /* read the buf from user memory here */
error = copy_from_user(kml_fsdata->kml_buf, input.recbuf, input.reclen); if (copy_from_user(kml_fsdata->kml_buf, input.recbuf, input.reclen)) {
if ( error ) {
EXIT; EXIT;
return error; return -EFAULT;
} }
kml_fsdata->kml_len = input.reclen; kml_fsdata->kml_len = input.reclen;
...@@ -94,21 +91,19 @@ int do_kml_reint (struct file *file, unsigned long arg) ...@@ -94,21 +91,19 @@ int do_kml_reint (struct file *file, unsigned long arg)
struct presto_file_set *fset; struct presto_file_set *fset;
ENTRY; ENTRY;
error = copy_from_user(&input, (char *)arg, sizeof(input)); if (copy_from_user(&input, (char *)arg, sizeof(input))) {
if ( error ) {
EXIT; EXIT;
return error; return -EFAULT;
} }
PRESTO_ALLOC(path, char *, input.namelen + 1); PRESTO_ALLOC(path, char *, input.namelen + 1);
if ( !path ) { if ( !path ) {
EXIT; EXIT;
return -ENOMEM; return -ENOMEM;
} }
error = copy_from_user(path, input.volname, input.namelen); if (copy_from_user(path, input.volname, input.namelen)) {
if ( error ) {
PRESTO_FREE(path, input.namelen + 1); PRESTO_FREE(path, input.namelen + 1);
EXIT; EXIT;
return error; return -EFAULT;
} }
path[input.namelen] = '\0'; path[input.namelen] = '\0';
fset = kml_getfset (path); fset = kml_getfset (path);
...@@ -138,7 +133,8 @@ int do_kml_reint (struct file *file, unsigned long arg) ...@@ -138,7 +133,8 @@ int do_kml_reint (struct file *file, unsigned long arg)
strlen (close->path) + 1, input.pathlen); strlen (close->path) + 1, input.pathlen);
error = -ENOMEM; error = -ENOMEM;
} }
copy_to_user((char *)arg, &input, sizeof (input)); if (copy_to_user((char *)arg, &input, sizeof (input)))
return -EFAULT;
} }
return error; return error;
} }
...@@ -161,10 +157,9 @@ int end_kml_reint (struct file *file, unsigned long arg) ...@@ -161,10 +157,9 @@ int end_kml_reint (struct file *file, unsigned long arg)
char *path; char *path;
ENTRY; ENTRY;
error = copy_from_user(&input, (char *)arg, sizeof(input)); if (copy_from_user(&input, (char *)arg, sizeof(input))) {
if ( error ) {
EXIT; EXIT;
return error; return -EFAULT;
} }
PRESTO_ALLOC(path, char *, input.namelen + 1); PRESTO_ALLOC(path, char *, input.namelen + 1);
...@@ -172,11 +167,11 @@ int end_kml_reint (struct file *file, unsigned long arg) ...@@ -172,11 +167,11 @@ int end_kml_reint (struct file *file, unsigned long arg)
EXIT; EXIT;
return -ENOMEM; return -ENOMEM;
} }
error = copy_from_user(path, input.volname, input.namelen); if (copy_from_user(path, input.volname, input.namelen)) {
if ( error ) { if ( error ) {
PRESTO_FREE(path, input.namelen + 1); PRESTO_FREE(path, input.namelen + 1);
EXIT; EXIT;
return error; return -EFAULT;
} }
path[input.namelen] = '\0'; path[input.namelen] = '\0';
fset = kml_getfset (path); fset = kml_getfset (path);
...@@ -193,7 +188,8 @@ int end_kml_reint (struct file *file, unsigned long arg) ...@@ -193,7 +188,8 @@ int end_kml_reint (struct file *file, unsigned long arg)
#if 0 #if 0
input.newpos = kml_upc->newpos; input.newpos = kml_upc->newpos;
input.count = kml_upc->count; input.count = kml_upc->count;
copy_to_user((char *)arg, &input, sizeof (input)); if (copy_to_user((char *)arg, &input, sizeof (input)))
return -EFAULT;
#endif #endif
return error; return error;
} }
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment