Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933029AbbDNQqe (ORCPT ); Tue, 14 Apr 2015 12:46:34 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35552 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932998AbbDNQq0 (ORCPT ); Tue, 14 Apr 2015 12:46:26 -0400 Message-ID: <552D445E.3040503@6wind.com> Date: Tue, 14 Apr 2015 18:46:22 +0200 From: Nicolas Dichtel Reply-To: nicolas.dichtel@6wind.com Organization: 6WIND User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Erez Shitrit , Honggang Li CC: Roland Dreier , sean.hefty@intel.com, hal.rosenstock@gmail.com, kaber@trash.net, davem@davemloft.net, Alex Estrin , Doug Ledford , edumazet@google.com, Erez Shitrit , maheshb@google.com, jbenc@redhat.com, ebiederm@xmission.com, elfring@users.sourceforge.net, f.fainelli@gmail.com, linux@roeck-us.net, andrew@lunn.ch, sfeldma@gmail.com, alexander.h.duyck@intel.com, "linux-rdma@vger.kernel.org" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH linux-next 1/4] infiniband/ipoib: fix possible NULL pointer dereference in ipoib_get_iflink References: <1429024817-21561-1-git-send-email-honli@redhat.com> <1429024817-21561-2-git-send-email-honli@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 743 Lines: 19 Le 14/04/2015 18:30, Erez Shitrit a écrit : > On Tue, Apr 14, 2015 at 6:20 PM, Honggang Li wrote: [snip] > This will make parent interface to return 0 instead of its own ifindex. > I would suggest write something like that: > > + /* parent interface */ > + if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) > + return dev->ifindex; > + > + /* child/vlan interface */ > + if (!priv->parent) > + return -1; 'return 0' here. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/