Re: Assuming NULL

From: Christoph Hellwig
Date: Sat Jun 11 2005 - 12:36:00 EST


On Sat, Jun 11, 2005 at 06:24:22PM +0200, Jan Engelhardt wrote:
> Hi developers,
>
>
>
> some places in fs/*.c have conditions like
>
> (namei.c, 238, in "int permission()"):
> if(inode->i_op && inode->i_op->permission)
>
> Others just have
> (namei.c, 813, in "int fastcall link_path_walk()"):
> if(!inode->i_op->lookup)
>
> My question is: Which one is right wrt the case "i_op ==/!= NULL"?
> There are two ways:
>
> - the kernel assumes i_op (and similar) is always non-NULL
> => then we can remove a lot of checks, like the first example above

i_op must not be NULL .alloc_inode() intitializes it to &empty_iops,
and setting it to NULL would be a bug.

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