From patchwork Sat Nov 19 17:40:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Lambert X-Patchwork-Id: 9438289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5034560469 for ; Sat, 19 Nov 2016 17:44:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 353FE289DB for ; Sat, 19 Nov 2016 17:44:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17F97289ED; Sat, 19 Nov 2016 17:44:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07474289DB for ; Sat, 19 Nov 2016 17:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752652AbcKSRoM (ORCPT ); Sat, 19 Nov 2016 12:44:12 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33401 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750958AbcKSRoL (ORCPT ); Sat, 19 Nov 2016 12:44:11 -0500 Received: by mail-wm0-f67.google.com with SMTP id u144so14683460wmu.0; Sat, 19 Nov 2016 09:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=PuV47xhlAKe2iJnmloUXghbJw2DchMn1niyYcDmlaic=; b=z0ol5J3G/hkJqkOLLoawzWYZTjGGLTtc3mIB+Q3nQohGGbmW4dbFIRcc0EvYmF/6hf Z+hMPOX7uHKqcA3/IotVET9JKr0QKOjg/NR3l23S7gEH7cryL0x4Qh7x9SnHqlRuY1mX fARk8Br83ppMaxu7rKr7lgumbrV/nNdbX/giH8FbdpkWnTn7nVR43n4gC0ULcGDo+krg uzYVsixDNUuubx0KVjsVF5nz8rwYJHDrm7jZMrw6Mau6ZKIBNoX8aRn0tEtw5tKoYqWQ 8mouEKTkcTBpx4OEfPBrNosgvsYuW6nJaxDNIGRVc7SQbgndGgxd70brH9LhEXIr0ROt U2yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PuV47xhlAKe2iJnmloUXghbJw2DchMn1niyYcDmlaic=; b=Y/JD28hkZNGsw3fLLZkTMJxxBatVWW0CyxSGUFlYEJgbrQf5KV5XPr8ZXxSj4/TzdG 5cgGTkXiLAwRNhXDNTdwJGQbLUqtANJ5WTxs3cqGVCk6azCjwzKKs8PpUQ1Nq8T5+05K jWBfoENFvTMalRpVa5usVDMmu73N2d1j1ISBvspVjEj0cX9UBHUA8w1MJtsPPJPkrjN3 gCiEFuFN2J2dQM/vz0HABnIISjLEBQZQvy9ZPoxmzE9FXagEpDS/9P1Bz8V/KQIDcPyi l2qxloNTxGE/nkYfBfj6zJignTUM9f/eeMcBkWSS8B8q+c/ZMkaKqbX87G23sseUICOr jz+Q== X-Gm-Message-State: AKaTC009aeEzh5Y/SKG/Ju2Lv08Mj4JcfdWTG5Z1HJQ+jBqy+PhWJpsMlouDXmvL0BtSKA== X-Received: by 10.28.54.97 with SMTP id d94mr5150759wma.28.1479577450133; Sat, 19 Nov 2016 09:44:10 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:8a86:9030:c685:8ff:fe2a:cb32]) by smtp.gmail.com with ESMTPSA id m9sm9805957wma.0.2016.11.19.09.44.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2016 09:44:09 -0800 (PST) From: Quentin Lambert To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Quentin Lambert Subject: [PATCH] scsi: aic94xx: Add a missing call to kfree Date: Sat, 19 Nov 2016 18:40:38 +0100 Message-Id: <20161119174038.20083-1-lambert.quentin@gmail.com> X-Mailer: git-send-email 2.10.2 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Quentin Lambert --- drivers/scsi/aic94xx/aic94xx_hwi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 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 --- 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);