Re: Fix UDF-FS potentially dereferencing null

From: Linus Torvalds
Date: Fri Apr 16 2004 - 19:46:05 EST




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

int notify_change(struct dentry * dentry, struct iattr * attr)
{
struct inode * __safe inode = dentry->d_inode;

and it should actually warn you if you test such a safe variable:

warning: fs/attr.c:138:6: testing a 'safe expression'

Ehh?

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/