diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/fld/lproc_fld.c')
-rw-r--r-- | drivers/staging/lustre/lustre/fld/lproc_fld.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c index 95e7de18d2f1..8c5a65704a37 100644 --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c @@ -87,13 +87,21 @@ fld_proc_hash_seq_show(struct seq_file *m, void *unused) } static ssize_t -fld_proc_hash_seq_write(struct file *file, const char *buffer, - size_t count, loff_t *off) +fld_proc_hash_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) { struct lu_client_fld *fld; struct lu_fld_hash *hash = NULL; + char fh_name[8]; int i; + if (count > sizeof(fh_name)) + return -ENAMETOOLONG; + + if (copy_from_user(fh_name, buffer, count) != 0) + return -EFAULT; + fld = ((struct seq_file *)file->private_data)->private; LASSERT(fld != NULL); @@ -101,7 +109,7 @@ fld_proc_hash_seq_write(struct file *file, const char *buffer, if (count != strlen(fld_hash[i].fh_name)) continue; - if (!strncmp(fld_hash[i].fh_name, buffer, count)) { + if (!strncmp(fld_hash[i].fh_name, fh_name, count)) { hash = &fld_hash[i]; break; } @@ -146,7 +154,7 @@ static int fld_proc_cache_flush_release(struct inode *inode, struct file *file) return 0; } -struct file_operations fld_proc_cache_flush_fops = { +static struct file_operations fld_proc_cache_flush_fops = { .owner = THIS_MODULE, .open = fld_proc_cache_flush_open, .write = fld_proc_cache_flush_write, |