Re: Fix UDF-FS potentially dereferencing null

From: Arjan van de Ven
Date: Sat Apr 17 2004 - 05:10:53 EST


On Sat, 2004-04-17 at 02:44, Linus Torvalds wrote:
> On Sat, 17 Apr 2004, Dave Jones wrote:
> >
> > And there's a *lot* of them. Those half dozen or so patches earlier were
> > results of just a quick random skim of the list the coverity folks came up with.
> >
> > It'll take a lot of effort to 'fix' them all, and given the non-severity
> > of a lot of them, I'm not convinced it's worth the effort.
>
> Just for the fun of it, I added a "safe" attribute to sparse (hey, it was
> trivial), and made it warn if you test a safe variable.
>
> You can do
>
> #define __safe __attribute__((safe))
>
> static struct denty *
> udf_lookup(struct inode * __safe dir,
> struct dentry * __safe dentry,
> struct nameidata * __safe nd);
>
> or

Hi,

is it maybe a good idea to map this to gcc's "nonnull" attribute in some
way? That way both sparse and the compiler get this explicit
knowledge.... (afaics gcc will then also just optimize out the null ptr
checks)

Attachment: signature.asc
Description: This is a digitally signed message part