Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753484AbbDNIIk (ORCPT ); Tue, 14 Apr 2015 04:08:40 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:35419 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753335AbbDNIIa (ORCPT ); Tue, 14 Apr 2015 04:08:30 -0400 Message-ID: <552CCAFA.8030107@profitbricks.com> Date: Tue, 14 Apr 2015 10:08:26 +0200 From: Michael Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jason Gunthorpe CC: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Tucker , Steve Wise , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran , Ira Weiny , Tom Talpey , Doug Ledford Subject: Re: [PATCH v3 07/28] IB/Verbs: Reform IB-ulp ipoib References: <552BB470.4090407@profitbricks.com> <552BB5AC.6050101@profitbricks.com> <20150413192701.GA19112@obsidianresearch.com> In-Reply-To: <20150413192701.GA19112@obsidianresearch.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1371 Lines: 50 On 04/13/2015 09:27 PM, Jason Gunthorpe wrote: > On Mon, Apr 13, 2015 at 02:25:16PM +0200, Michael Wang wrote: >> dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); >> if (!dev_list) >> @@ -1673,13 +1671,19 @@ static void ipoib_add_one(struct ib_device *device) >> } >> >> for (p = s; p <= e; ++p) { >> - if (rdma_port_get_link_layer(device, p) != IB_LINK_LAYER_INFINIBAND) >> + if (!rdma_tech_ib(device, p)) >> continue; >> dev = ipoib_add_port("ib%d", device, p); >> if (!IS_ERR(dev)) { >> priv = netdev_priv(dev); >> list_add_tail(&priv->list, dev_list); >> } >> + count++; >> + } >> + >> + if (!count) { >> + kfree(dev_list); >> + return; >> } > > This doesn't quite look right, it should be 'goto error1' > > But then I read 'goto error1' and it doesn't look like it can handle > cm_dev->port being NULL, so more fixing is needed. Nice catch ;-) I guess the 'count++' should be inside 'if (!IS_ERR(dev))' after link the node. Regards, Michael Wang > > Ditto for cm_remove_one > > Should audit all uses of cm_dev->port[] to make sure they can all > handle NULL. > > Jason > -- 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/