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

From: Valdis . Kletnieks
Date: Thu Oct 07 2004 - 13:25:24 EST


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

Attachment: pgp00000.pgp
Description: PGP signature