Re: Assuming NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Engelhardt <[email protected]> writes:

> 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
>
> - the kernel does not assume...
>   => then we need some extra checks, like in the second example above

And a third:

- in some places it's safe to assume non-NULL, but not always
  => then we need to check only the unsafe places

-- 
Måns Rullgård
[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux