From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7453C433DF for ; Thu, 9 Jul 2020 02:11:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89BF0206F6 for ; Thu, 9 Jul 2020 02:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726309AbgGICLr (ORCPT ); Wed, 8 Jul 2020 22:11:47 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:57750 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726118AbgGICLr (ORCPT ); Wed, 8 Jul 2020 22:11:47 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2EF1B20BDB74D96789CF; Thu, 9 Jul 2020 10:11:43 +0800 (CST) Received: from [10.174.179.105] (10.174.179.105) by smtp.huawei.com (10.3.19.205) with Microsoft SMTP Server (TLS) id 14.3.487.0; Thu, 9 Jul 2020 10:11:39 +0800 Subject: Re: [PATCH] scsi: fcoe: add missed kfree() in an error path To: Markus Elfring , References: <977e2781-99ed-54c0-27ad-82d768a1c1e6@web.de> CC: , , "Hannes Reinecke" , "James E. J. Bottomley" , "Martin K. Petersen" , Neerav Parikh , Robert Love From: Jing Xiangfeng Message-ID: <5F067CDA.8010404@huawei.com> Date: Thu, 9 Jul 2020 10:11:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <977e2781-99ed-54c0-27ad-82d768a1c1e6@web.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.105] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/7/7 19:38, Markus Elfring wrote: >> fcoe_fdmi_info() misses to call kfree() in an error path. >> Add the missed function call to fix it. > > I suggest to use an additional jump target for the completion > of the desired exception handling. > > > … >> +++ b/drivers/scsi/fcoe/fcoe.c >> @@ -830,6 +830,7 @@ static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev) >> if (rc) { >> printk(KERN_INFO "fcoe: Failed to retrieve FDMI " >> "information from netdev.\n"); >> + kfree(fdmi); >> return; >> } > > - return; > + goto free_fdmi; > > > How do you think about to apply any further coding style adjustments? The local variable "fdmi" is invisible to the function. See fcoe_fdmi_info(). Thanks > > Regards, > Markus > . > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jing Xiangfeng Date: Thu, 09 Jul 2020 02:11:38 +0000 Subject: Re: [PATCH] scsi: fcoe: add missed kfree() in an error path Message-Id: <5F067CDA.8010404@huawei.com> List-Id: References: <977e2781-99ed-54c0-27ad-82d768a1c1e6@web.de> In-Reply-To: <977e2781-99ed-54c0-27ad-82d768a1c1e6@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: Markus Elfring , linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Hannes Reinecke , "James E. J. Bottomley" , "Martin K. Petersen" , Neerav Parikh , Robert Love On 2020/7/7 19:38, Markus Elfring wrote: >> fcoe_fdmi_info() misses to call kfree() in an error path. >> Add the missed function call to fix it. > > I suggest to use an additional jump target for the completion > of the desired exception handling. > > > =E2=80=A6 >> +++ b/drivers/scsi/fcoe/fcoe.c >> @@ -830,6 +830,7 @@ static void fcoe_fdmi_info(struct fc_lport *lport, s= truct net_device *netdev) >> if (rc) { >> printk(KERN_INFO "fcoe: Failed to retrieve FDMI " >> "information from netdev.\n"); >> + kfree(fdmi); >> return; >> } > > - return; > + goto free_fdmi; > > > How do you think about to apply any further coding style adjustments? The local variable "fdmi" is invisible to the function. See fcoe_fdmi_info(). Thanks > > Regards, > Markus > . >