Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1315547ybt; Thu, 9 Jul 2020 04:09:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyziTqDr4tm1M0YZdK2nBgmmsDH4YqrQFAwIfOBxnvgpTD5Xg30oAfMxZw7N8FTjq+lbWKs X-Received: by 2002:aa7:d043:: with SMTP id n3mr74233996edo.102.1594292977843; Thu, 09 Jul 2020 04:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594292977; cv=none; d=google.com; s=arc-20160816; b=hPR2yyWz0r/JGZE77f18d9VbslTKm/lct4oMgyzDVLdAbUEroEIFvtlXsV7yAvsB+I rZXogW8gVmJ5oZb7d6L1Bpx1MgV+cnFVCW3o4+H1xsSflMotn7/fiZB4ERCr6zBE+Yui vhZeFaPzs9nLFNTZJiFpEXoCyL32MZS27txKLyoGuFx74rLEOuEqjZHEAHbnpZ1+1p3p GGMTJQy6EnulFCkl+aS0GQ44sW7bfzePKq/A3H0FMSJRHDJEP8OKkfaA5TggXHD5Wtbh /IU+ufsC4qcl/Y4NvZodS8229UNI9bB+Z4ALjxkgXtEyqFlRv5b/LEe5iXQ2fHB4J3EZ dGeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=r1DhK99GcP1EZyVKoP498SKY+aam0tZ/USz/l8tJ0O8=; b=z+zEBvXcHwooKVFKfEqvoKJL5oLpG0UjDUF01sLhzAgfGKCs0YNfv3y70SxiIPC9gx JDO8rqnSMCQCquRnGbHcQtx99SEGosaw3NCLQgw4p/sDL4N3wpdUvWJPhjK9D01sLYnr iSQYX7318pW4Z69t/0YKZfnIQj1uuhom79zqhYi6LuFHkyX+GFuzfU9PVSrgk9jU4n4t sUzBF1WwwIDlQbNW+7MXOVT5korg0dY+eQtBs1v2VlmBmtigBj99pJYE3rF4jBxEo8rf LxgKG742xNHXIVyc7o673Pau4VrpNhjhU6a9n1rjDSNn6gMXzrAjZbARJ2kw21gplGo6 VVmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si1862939edr.144.2020.07.09.04.09.14; Thu, 09 Jul 2020 04:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbgGILIQ (ORCPT + 99 others); Thu, 9 Jul 2020 07:08:16 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:56482 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726302AbgGILIQ (ORCPT ); Thu, 9 Jul 2020 07:08:16 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1D9735F93C593A6A1104; Thu, 9 Jul 2020 19:08:14 +0800 (CST) Received: from [10.174.179.105] (10.174.179.105) by smtp.huawei.com (10.3.19.214) with Microsoft SMTP Server (TLS) id 14.3.487.0; Thu, 9 Jul 2020 19:08:09 +0800 Subject: Re: [PATCH] scsi: fcoe: add missed kfree() in an error path To: Markus Elfring , References: <977e2781-99ed-54c0-27ad-82d768a1c1e6@web.de> <5F067CDA.8010404@huawei.com> CC: , , "Hannes Reinecke" , "James E. J. Bottomley" , "Martin K. Petersen" , Neerav Parikh From: Jing Xiangfeng Message-ID: <5F06FA99.7030705@huawei.com> Date: Thu, 9 Jul 2020 19:08:09 +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: 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/9 15:22, 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. > > I have got understanding difficulties for this information. > The function call “kfree(fdmi)” is already used at the end of this if branch. > Thus I propose to add a label there. > > Do you notice any additional improvement possibilities for this software module? Indeed, Will change in the next version. Thanks for your review > > Regards, > Markus > . >