Re: [PATCH] staging: lustre: fix sparse warning on LPROC_SEQ_FOPS macros

Tristan Lelong
2014-12-05T08:37:23Z

On Fri, Dec 05, 2014 at 12:28:11AM -0800, Joe Perches wrote:
> On Fri, 2014-12-05 at 00:03 -0800, Tristan Lelong wrote:
> > This patch fix a sparse warning in lustre sources
> >
> > warning: incorrect type in argument 1 (different address spaces)
> > expected void [noderef] <asn:1>*to
> > got char *<noident>
> []
> > diff --git 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 name[80];
> > int i;
> >
> > + if (count > 80)
> > + return -ENAMETOOLONG;
> > +
> > + if (copy_from_user(name, buffer, count) != 0)
> > + return -EFAULT;
> > +
> > fld = ((struct seq_file *)file->private_data)->private;
> > LASSERT(fld != NULL);
> >
>
> Why 80? Is there no #define for this length?
>
No, there is no define.

I thought about adding one, but several other files and structure members in the lustre sources are using this specific value, and it seemed like a modification to do in another patch.

Let me know if you feel I should do it in a patch serie.

Regards