Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6480371rdb; Tue, 2 Jan 2024 03:33:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLMM6uD7CZHrQ7ejyT2Cspo/z7hz/sQi17Msd9aBIcZI2LLqUvmuCEhEFpfjdPEPpT5Gg2 X-Received: by 2002:a05:6358:7f02:b0:174:e99d:ebcc with SMTP id p2-20020a0563587f0200b00174e99debccmr16476753rwn.10.1704195225614; Tue, 02 Jan 2024 03:33:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704195225; cv=none; d=google.com; s=arc-20160816; b=jFqEGhr+gHBUIrvSshMyrhG3yypvOoOhKAty709lCivisFs3F/k/u7OCpQkLpho9o7 G7UN3rW7/2puAHF0UOyH5XVB7UEAz3Jwz2ScfL6hhkoaOBlY0moH9D0xejrOBKImZjvg 2JShRK0Xlpi2YVzyzZ8jSZa23gSgkg/il/iSK4LDqQ+GEs7y4o9PoGhbTd90Nk5TwiAu k/OK7YQW+FVSiqQYnnUfwvMK17Dian22NgB/Ow8IlKT7CY4FG8XFoiy7FlQCrBTII6/Y foccX0R+wR/pWybQzclsNZrPE8PS+7W4gY+u0z2nReBmNU21KZLzML+aOtXygbITGy/6 NdaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=TKJAjMhcZJuWWXM+CD92VJI4ShCetcBpzUDWpfFV6UI=; fh=bSnWWKMcgDxzVfJHx3jNsnyuKXZf3LG81/qin7Gz+kc=; b=UljdtGRNHHW1V8kYpGDlXrKiyP53o5/XcEwC5+w1MGMCC8OTt0NOjeFYDIguvbb2Qa 9kzeYa0iKCfVRveeN/KQ9EemgdYOSZDs5x7Vy9K2HOdC3HKpyntOhbrUin6R2NYuq9CZ L6K84A/XH4nY20DTNFiTCzyXWEKN4Ls2MBbv0eWsaPLJ4QthDILNYPeexYysFTnmpTP1 /riLgOKHuYcObDTCkox34vQB09FFkW4MWZQvfxRsw/6aYt9oMtncPM3A1GpYgekYjOsZ PIj9ELo+TEqJDRvf8cM5h935IerAXYXxZCL0AxHYHtHVARzgSfMe8AznZpkC8JcLOllO HNJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-14296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r18-20020a635d12000000b005ce4e2ba741si9633264pgb.160.2024.01.02.03.33.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 03:33:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-14296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 406602832BC for ; Tue, 2 Jan 2024 11:33:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDA2DEAE0; Tue, 2 Jan 2024 11:33:33 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25332F510; Tue, 2 Jan 2024 11:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VzqYx19_1704195199; Received: from 30.221.130.246(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VzqYx19_1704195199) by smtp.aliyun-inc.com; Tue, 02 Jan 2024 19:33:20 +0800 Message-ID: Date: Tue, 2 Jan 2024 19:33:18 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [0/2] net/smc: Adjustments for two function implementations To: Markus Elfring , linux-s390@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, "David S. Miller" , "D. Wythe" , Eric Dumazet , Jakub Kicinski , Jan Karcher , Paolo Abeni , Tony Lu , Wenjia Zhang Cc: LKML References: <8ba404fd-7f41-44a9-9869-84f3af18fb46@web.de> <93033352-4b9c-bf52-1920-6ccf07926a21@linux.alibaba.com> <46fe66f7-dc3b-4863-96e8-7a855316e8bd@web.de> From: Wen Gu In-Reply-To: <46fe66f7-dc3b-4863-96e8-7a855316e8bd@web.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/1/2 16:51, Markus Elfring wrote: > … >>> A few update suggestions were taken into account >>> from static source code analysis. > … >>>    Return directly after a failed kzalloc() in smc_fill_gid_list() >>>    Improve exception handling in smc_llc_cli_add_link_invite() >>> >>>   net/smc/af_smc.c  |  2 +- >>>   net/smc/smc_llc.c | 15 +++++++-------- >>>   2 files changed, 8 insertions(+), 9 deletions(-) > … >> I see you want to fix the kfree(NULL) issues in these two patches. > > I propose to avoid redundant function calls at various source code places. > > >> But I am wondering if this is necessary, since kfree() can handle NULL correctly. > > Would you prefer only required data processing in affected function implementations? > Thank you Markus. I understood that you want to avoid redundant function calls. But it is not very attractive to me since the calls occur on low-frequency paths or unlikely condition, resulting in limited performance loss and the current kfree() usage is fine and common. So what is the benfit? I noticed that some other discussions are on-going. It seems like you are trying to change other similiar places. Let's collect more opinions. https://lore.kernel.org/netdev/828bb442-29d0-4bb8-b90d-f200bdd4faf6@web.de/ https://lore.kernel.org/netdev/90679f69-951c-47b3-b86f-75fd9fde3da3@web.de/ https://lore.kernel.org/netdev/dc0a1c9d-ceca-473d-9ad5-89b59e6af2e7@web.de/ https://lore.kernel.org/netdev/cde82080-c715-473c-97ac-6ef66bba6d64@web.de/ Thanks. > Regards, > Markus