All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Whitehouse <steve@chygwyn.com>
To: Pavel Emelyanov <xemul@openvz.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Patrick Caulfield <patrick@tykepenguin.com>,
	Linux Netdev List <netdev@vger.kernel.org>,
	devel@openvz.org, linux-decnet-user@lists.sourceforge.net
Subject: Re: [PATCH][DECNET] dn_nl_deladdr() almost always returns no error
Date: Thu, 29 Nov 2007 16:35:43 +0000	[thread overview]
Message-ID: <20071129163543.GA15456@fogou.chygwyn.com> (raw)
In-Reply-To: <474EE8E0.3050107@openvz.org>

Hi,

On Thu, Nov 29, 2007 at 07:29:20PM +0300, Pavel Emelyanov wrote:
> 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?
>
The patch looks good to me.
 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> 
> ---
> 
> 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))
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2007-11-29 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 16:29 [PATCH][DECNET] dn_nl_deladdr() almost always returns no error Pavel Emelyanov
2007-11-29 16:35 ` Steven Whitehouse [this message]
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=20071129163543.GA15456@fogou.chygwyn.com \
    --to=steve@chygwyn.com \
    --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 \
    --cc=xemul@openvz.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.