question about xt_find_table_lock

3 messages, 2 authors, 2016-11-11 · open the first message on its own page

question about xt_find_table_lock

From: Julia Lawall <hidden>
Date: 2016-11-11 10:50:03

The function xt_find_table_lock defined in net/netfilter/x_tables.c is
preceeded by a comment that says that it returns ERR_PTR() on error.  But
looking at the definition, I only see occurrences of return NULL and
returns of pointers that have previously been dereferenced.  Is it the
code or the documentation that is incorrect?  The call sites seem to be
using IS_ERR_OR_NULL.  Is there a plan to return ERR_PTR values in the
future?

julia

Re: question about xt_find_table_lock

From: Florian Westphal <fw@strlen.de>
Date: 2016-11-11 11:25:30

Julia Lawall [off-list ref] wrote:
The function xt_find_table_lock defined in net/netfilter/x_tables.c is
preceeded by a comment that says that it returns ERR_PTR() on error.  But
looking at the definition, I only see occurrences of return NULL and
returns of pointers that have previously been dereferenced.  Is it the
code or the documentation that is incorrect?  The call sites seem to be
using IS_ERR_OR_NULL.  Is there a plan to return ERR_PTR values in the
future?
It used to return ERR_PTR, see:

commit 7926dbfa4bc14e27f4e18a6184a031a1c1e077dc
netfilter: don't use mutex_lock_interruptible()

So the comment isn't correct anymore and callers could test vs NULL.

Re: question about xt_find_table_lock

From: Julia Lawall <hidden>
Date: 2016-11-11 11:58:34


On Fri, 11 Nov 2016, Florian Westphal wrote:
Julia Lawall [off-list ref] wrote:
quoted
The function xt_find_table_lock defined in net/netfilter/x_tables.c is
preceeded by a comment that says that it returns ERR_PTR() on error.  But
looking at the definition, I only see occurrences of return NULL and
returns of pointers that have previously been dereferenced.  Is it the
code or the documentation that is incorrect?  The call sites seem to be
using IS_ERR_OR_NULL.  Is there a plan to return ERR_PTR values in the
future?
It used to return ERR_PTR, see:

commit 7926dbfa4bc14e27f4e18a6184a031a1c1e077dc
netfilter: don't use mutex_lock_interruptible()

So the comment isn't correct anymore and callers could test vs NULL.
Thanks for the quick feedback.

julia
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help