Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932775AbcKVPva (ORCPT ); Tue, 22 Nov 2016 10:51:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41954 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753107AbcKVPv2 (ORCPT ); Tue, 22 Nov 2016 10:51:28 -0500 Subject: Re: [PATCH] scsi: aic94xx: Add a missing call to kfree To: Quentin Lambert , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20161119174038.20083-1-lambert.quentin@gmail.com> From: Tomas Henzl Message-ID: Date: Tue, 22 Nov 2016 16:51:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161119174038.20083-1-lambert.quentin@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 22 Nov 2016 15:51:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1233 Lines: 38 On 19.11.2016 18:40, Quentin Lambert wrote: > Most error branches following the call to kzalloc contain > a call to kfree. This patch add these calls where they are > missing. > > This issue was found with Hector. Hi Quentin, most error branches also do set the freed pointer to NULL, please do the same. tomash > Signed-off-by: Quentin Lambert > > --- > drivers/scsi/aic94xx/aic94xx_hwi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- a/drivers/scsi/aic94xx/aic94xx_hwi.c > +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c > @@ -228,8 +228,10 @@ static int asd_init_scbs(struct asd_ha_s > bitmap_bytes = (asd_ha->seq.tc_index_bitmap_bits+7)/8; > bitmap_bytes = BITS_TO_LONGS(bitmap_bytes*8)*sizeof(unsigned long); > asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL); > - if (!asd_ha->seq.tc_index_bitmap) > + if (!asd_ha->seq.tc_index_bitmap) { > + kfree(asd_ha->seq.tc_index_array); > return -ENOMEM; > + } > > spin_lock_init(&seq->tc_index_lock); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html