lkml.org 
[lkml]   [2004]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Kill a sparse warning in binfmt_elf.c
From
Date
On Thu, 07 Oct 2004 11:49:24 PDT, Arun Sharma said:

> >> static int dump_write(struct file *file, const void *addr, int nr)
> >> {
> >> - return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
> >> + return file->f_op->write(file, (const char __user *) addr, nr, &file->f
_pos) == nr;
> >> }
> >
> > wouldn't it be more useful to put the annotation into the *prototype* for
> > the dump_write() function, so that we get sparse typechecking for the
> > caller(s) of this function? Your fix just kills the warning - when the *re
al*
> > problem is that we're called with a 'void *' that we then cast to something
> > without any real double check on what it is....
>
> dump_write() is a static function without a prototype.

static int dump_write(struct file *file, const char __user *addr, int nr)
{
return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
}

And then go find the callers and make sure what they're passing is a
'const char __user *' rather than a 'const void *'....
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.049 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site