Re: [Patch] Possible NULL pointer dereference in fs/configfs/dir.c

From: Adrian Bunk
Date: Sat Mar 25 2006 - 11:57:36 EST


On Wed, Mar 22, 2006 at 03:27:09PM -0800, Joel Becker wrote:
> On Thu, Mar 23, 2006 at 12:05:29AM +0100, Eric Sesterhenn wrote:
> > this fixes coverity bug #845, if group is NULL,
> > we dereference it when setting up dentry.
>
> Is the converity checker merly looking at in-function patterns?
> Where can I access the bug report (sorry for the question).
> group cannot be null here, we aren't called any other way. So
> while you are correct that the code below is needed in the presence of a
> NULL group, really the "if (group" isn't necessary, just the "if
> (group->default_groups)". I could even BUG_ON() if you'd like.

Coverity is correct that something is wrong:

<-- snip -->

...
struct dentry *dentry = group->cg_item.ci_dentry;
int ret = 0;
int i;

if (group && group->default_groups) {
...

<-- snip -->

The question is only whether the dereferencing is a real bug or there's
only the harmless issue of a superfluous check.

> Joel

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

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