Re: [PATCH] remove net driver ugliness that sparse complains about

From: Linus Torvalds
Date: Sat May 29 2004 - 13:27:44 EST




On Sat, 29 May 2004, Jeff Garzik wrote:
>
> I'm a bit curious why sparse complained about taking the _address_ of
> pointer

It may not complain any more. Al sent me about 20 different test-cases for
things that sparse did wrong, and I've fixed most of them. As of
yesterday, most sparse warnings really _are_ valid (yeah, I'm sure there
are some broken cases still, but if so, now they are in a clear minority).

Note that that doesn't mean that they are all easy to fix. Some code tends
to re-use the same structure for sometimes holding kernel pointers, and
sometimes holding user pointers.

Since the whole point of sparse is to have _static_ typechecking, such
code will never be sparse-clean, and either we have to ignore it, or we
should split up the use into two different kinds of structures (with the
same members apart from the address space) and explicitly convert between
the two. I'd obviously prefer that approach, but it might be a fair
amount of work (most of it should be really trivial, though, and I suspect
it would clarify pointer usage a lot to know when a "struct msghdr" points
to user space, and when it points to kernel space. Or whatever - maybe
that was a bad example).

Linus
-
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/