lkml.org 
[lkml]   [2009]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] fs/xfs: Drop unnecessary NULL test
On Tue, 14 Jul 2009, Olaf Weber wrote:

> Julia Lawall writes:
>
> > From: Julia Lawall <julia@diku.dk>
> > The result of container_of should not be NULL. In particular, in this case
> > the argument to the enclosing function has passed though INIT_DELAYED_WORK,
> > which dereferences it, implying that its container cannot be NULL.
>
> Given the defn of container_of() it seems clear that neither its input
> pointer nor its result should ever be NULL.

container_of just does pointer arithmetic. The result of that arithmetic
can be NULL, ie if the argument was obtained from an expression of the
form &x->f where x was NULL. But in principle, values should be checked
for NULL beforehand.

julia


\
 
 \ /
  Last update: 2009-07-14 14:19    [W:0.206 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site