From: Pavel Emelyanov <xemul@openvz.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Patrick Caulfield <patrick@tykepenguin.com>,
Linux Netdev List <netdev@vger.kernel.org>,
devel@openvz.org, linux-decnet-user@lists.sourceforge.net
Subject: [PATCH][DECNET] dn_nl_deladdr() almost always returns no error
Date: Thu, 29 Nov 2007 19:29:20 +0300 [thread overview]
Message-ID: <474EE8E0.3050107@openvz.org> (raw)
As far as I see from the err variable initialization
the dn_nl_deladdr() routine was designed to report errors
like "EADDRNOTAVAIL" and probaby "ENODEV".
But the code sets this err to 0 after the first nlmsg_parse
and goes on, returning this 0 in any case.
Is this made deliberately, or the patch below is correct?
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 66e266f..3bc82dc 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -651,16 +651,18 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct dn_dev *dn_db;
struct ifaddrmsg *ifm;
struct dn_ifaddr *ifa, **ifap;
- int err = -EADDRNOTAVAIL;
+ int err;
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
if (err < 0)
goto errout;
+ err = -ENODEV;
ifm = nlmsg_data(nlh);
if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL)
goto errout;
+ err = -EADDRNOTAVAIL;
for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) {
if (tb[IFA_LOCAL] &&
nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2))
next reply other threads:[~2007-11-29 16:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 16:29 Pavel Emelyanov [this message]
2007-11-29 16:35 ` [PATCH][DECNET] dn_nl_deladdr() almost always returns no error Steven Whitehouse
2007-11-30 12:44 ` Herbert Xu
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=474EE8E0.3050107@openvz.org \
--to=xemul@openvz.org \
--cc=devel@openvz.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-decnet-user@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=patrick@tykepenguin.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).