From: David Miller <davem@davemloft.net>
To: julia@diku.dk
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
paul.moore@hp.com, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] include/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument
Date: Tue, 01 Feb 2011 14:54:10 -0800 (PST) [thread overview]
Message-ID: <20110201.145410.115936566.davem@davemloft.net> (raw)
In-Reply-To: <Pine.LNX.4.64.1101281642080.8546@pc-004.diku.dk>
From: Julia Lawall <julia@diku.dk>
Date: Fri, 28 Jan 2011 16:43:40 +0100 (CET)
> nlmsg_cancel can accept NULL as its second argument, so for similarity,
> this patch extends genlmsg_cancel to be able to accept a NULL second
> argument as well.
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
I did a scan of all of the cases where this interface is used, and
I cannot find a situation where this capability would even be useful.
The use pattern is always:
hdr = genlmsg_put(skb, ...);
if (!hdr)
goto out;
NLA_PUT_*();
NLA_PUT_*();
....
return genlmsg_end(skb, hdr);
nla_put_failure:
genlmsg_cancel(skb, hdr);
out:
return -EWHATEVER;
Always, hdr will be non-NULL.
We have to allocate the header first, then put the netlink
attributes.
Looking over users of nlmsg_cancel(), the situation seems to
match identically.
Therefore, it seems to me that it makes more sense to remove
the NULL check from nlmsg_cancel() than to add the NULL check
to genlmsg_cancel().
Thanks.
next prev parent reply other threads:[~2011-02-01 22:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-28 15:43 [PATCH] include/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument Julia Lawall
2011-02-01 22:54 ` David Miller [this message]
2011-02-02 5:51 ` Julia Lawall
2011-02-02 6:17 ` Julia Lawall
2011-02-04 4:43 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110201.145410.115936566.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul.moore@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).