Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbdINCYl (ORCPT ); Wed, 13 Sep 2017 22:24:41 -0400 Received: from mga03.intel.com ([134.134.136.65]:54691 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbdINCYj (ORCPT ); Wed, 13 Sep 2017 22:24:39 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,390,1500966000"; d="scan'208";a="151622500" From: "Brown, Aaron F" To: Christophe JAILLET , "Waskiewicz Jr, Peter" , "Kirsher, Jeffrey T" CC: "netdev@vger.kernel.org" , "kernel-janitors@vger.kernel.org" , "intel-wired-lan@lists.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: RE: [Intel-wired-lan] [PATCH] igb: check memory allocation failure Thread-Topic: [Intel-wired-lan] [PATCH] igb: check memory allocation failure Thread-Index: AQHTHv+fAs763IiaBkWXRmCjnRUfm6KaeQIAgBlJM2A= Date: Thu, 14 Sep 2017 02:24:37 +0000 Message-ID: <309B89C4C689E141A5FF6A0C5FB2118B8C6A028B@ORSMSX101.amr.corp.intel.com> References: <20170827063951.5975-1-christophe.jaillet@wanadoo.fr> <95a0bc80-8b41-d74f-8059-ae7181493120@wanadoo.fr> In-Reply-To: <95a0bc80-8b41-d74f-8059-ae7181493120@wanadoo.fr> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.22.254.138] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v8E2OnGs020652 Content-Length: 1615 Lines: 46 > From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On Behalf > Of Christophe JAILLET > Sent: Monday, August 28, 2017 10:13 AM > To: Waskiewicz Jr, Peter ; Kirsher, Jeffrey T > > Cc: netdev@vger.kernel.org; kernel-janitors@vger.kernel.org; intel-wired- > lan@lists.osuosl.org; linux-kernel@vger.kernel.org > Subject: Re: [Intel-wired-lan] [PATCH] igb: check memory allocation failure > > Le 28/08/2017 à 01:09, Waskiewicz Jr, Peter a écrit : > > On 8/27/17 2:42 AM, Christophe JAILLET wrote: > >> Check memory allocation failures and return -ENOMEM in such cases, as > >> already done for other memory allocations in this function. > >> > >> This avoids NULL pointers dereference. > >> > >> Signed-off-by: Christophe JAILLET > >> --- > >> drivers/net/ethernet/intel/igb/igb_main.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> This seems to be fine from a "it does not break in testing" perspective, so... Tested-by: Aaron Brown > -PJ > > > Hi, > > in fact, there is no leak because the only caller of 'igb_sw_init()' > (i.e. 'igb_probe()'), already frees these resources in case of error, > see [1] > > These resources are also freed  in 'igb_remove()'. > > Best reagrds, > CJ > > [1]: > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux- > next.git/tree/drivers/net/ethernet/intel/igb/igb_main.c#n2775 But is PJ's comment saying that it is not really necessary? If so I tend to lean towards the don't touch it if it's not broken perspective.