netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: roy.qing.li@gmail.com
To: netdev@vger.kernel.org
Subject: [PATCH 2/3] ethernet/broadcom: ip6_route_output() never returns NULL.
Date: Wed, 22 Feb 2012 16:10:50 +0800	[thread overview]
Message-ID: <1329898251-5357-2-git-send-email-roy.qing.li@gmail.com> (raw)
In-Reply-To: <1329898251-5357-1-git-send-email-roy.qing.li@gmail.com>

From: RongQing.Li <roy.qing.li@gmail.com>

ip6_route_output() never returns NULL, so it is wrong to
check if the return value is NULL.

Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
---
 drivers/net/ethernet/broadcom/cnic.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index df42995..7b65716 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -3616,7 +3616,11 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
 		fl6.flowi6_oif = dst_addr->sin6_scope_id;
 
 	*dst = ip6_route_output(&init_net, NULL, &fl6);
-	if (*dst)
+	if ((*dst)->error) {
+		dst_release(*dst);
+		*dst = NULL;
+		return -ENETUNREACH;
+	} else
 		return 0;
 #endif
 
-- 
1.7.1

  reply	other threads:[~2012-02-22  8:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22  8:10 [PATCH 1/3] ipv6: ip6_route_output() never returns NULL roy.qing.li
2012-02-22  8:10 ` roy.qing.li [this message]
2012-02-22 19:50   ` [PATCH 2/3] ethernet/broadcom: " David Miller
2012-02-22  8:10 ` [PATCH 3/3] netfilter: " roy.qing.li
2012-02-22 19:50   ` David Miller
2012-02-22 19:50 ` [PATCH 1/3] ipv6: " 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=1329898251-5357-2-git-send-email-roy.qing.li@gmail.com \
    --to=roy.qing.li@gmail.com \
    --cc=netdev@vger.kernel.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 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).