patch-2.1.20 linux/fs/super.c
Next file: linux/include/asm-i386/string.h
Previous file: linux/fs/stat.c
Back to the patch index
Back to the overall index
- Lines: 63
- Date:
Tue Dec 31 21:19:32 1996
- Orig file:
v2.1.19/linux/fs/super.c
- Orig date:
Sun Dec 22 16:37:38 1996
diff -u --recursive --new-file v2.1.19/linux/fs/super.c linux/fs/super.c
@@ -213,7 +213,7 @@
static int fs_name(unsigned int index, char * buf)
{
struct file_system_type * tmp;
- int err, len;
+ int len;
tmp = file_systems;
while (tmp && index > 0) {
@@ -223,11 +223,7 @@
if (!tmp)
return -EINVAL;
len = strlen(tmp->name) + 1;
- err = verify_area(VERIFY_WRITE, buf, len);
- if (err)
- return err;
- copy_to_user(buf, tmp->name, len);
- return 0;
+ return copy_to_user(buf, tmp->name, len) ? -EFAULT : 0;
}
static int fs_maxindex(void)
@@ -477,7 +473,6 @@
struct ustat tmp;
struct statfs sbuf;
unsigned long old_fs;
- int error;
s = get_super(to_kdev_t(dev));
if (s == NULL)
@@ -486,10 +481,6 @@
if (!(s->s_op->statfs))
return -ENOSYS;
- error = verify_area(VERIFY_WRITE,ubuf,sizeof(struct ustat));
- if (error)
- return error;
-
old_fs = get_fs();
set_fs(get_ds());
s->s_op->statfs(s,&sbuf,sizeof(struct statfs));
@@ -499,8 +490,7 @@
tmp.f_tfree = sbuf.f_bfree;
tmp.f_tinode = sbuf.f_ffree;
- copy_to_user(ubuf,&tmp,sizeof(struct ustat));
- return 0;
+ return copy_to_user(ubuf,&tmp,sizeof(struct ustat)) ? -EFAULT : 0;
}
static struct super_block * read_super(kdev_t dev,const char *name,int flags,
@@ -807,7 +797,10 @@
if (!(page = __get_free_page(GFP_KERNEL))) {
return -ENOMEM;
}
- copy_from_user((void *) page,data,i);
+ if (copy_from_user((void *) page,data,i)) {
+ free_page(page);
+ return -EFAULT;
+ }
*where = page;
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov