Re: [PATCH] Kill a sparse warning in binfmt_elf.c

From: Arun Sharma
Date: Thu Oct 07 2004 - 14:06:38 EST


On 10/7/2004 11:11 AM, Valdis.Kletnieks@xxxxxx wrote:
On Wed, 06 Oct 2004 15:45:02 PDT, Arun Sharma said:

The attached patch kills a sparse warning in binfmt_elf.c:dump_write() by
adding a __user annotation.

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 *real*
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.

-Arun

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/