Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6306030rdb; Mon, 1 Jan 2024 18:13:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEwBJYpkMEiH06cf15q01SyYuuyP9+O61VmDmfJ1Va9wIWAXkG48ozqIuLI8n6N7hz7ubU X-Received: by 2002:a05:600c:b8e:b0:40d:8cd1:16e1 with SMTP id fl14-20020a05600c0b8e00b0040d8cd116e1mr102613wmb.4.1704161624907; Mon, 01 Jan 2024 18:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704161624; cv=none; d=google.com; s=arc-20160816; b=nLda1G9dYBr6TRIMMezX21g3LUzKqO/b7VF+j1Wl/z6wkDgVqYBATrBiR8FTYY2vBJ dmcVrwYZok+CU59oELD6KWWjFnmdtg4WqIbKT6qXGBF/Fwuxqj0cmnIN1zHog1vCc5E1 HD6j3f4YAE8qHE5yWniNpXV5z21N1C80DOHPVCWTmZblM+XvZXAt7R109tfdIVgRoKph qNaJxTmJPjaqllryoDLhfU0OEYbdldeGdODFfUHHuo1QnHu4TX1BMwRgYhXpraoLXDpp SxNAcfs2sFYJzFwr3SBb4lGKBa5HdIxYqsNAfgOuBrJFBBzfwcbkb6VnX3N6yK0kAjN5 x4+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date; bh=IfjRUAZeENy5wr7cuGU9GTZ+Aib+sD9e2iPZNk8YJ6o=; fh=ZpVz65prVw/TNRwAfASLLBy5mMlUdQ8zEJ9wRoQjyBA=; b=mQps03kb3ED1Jj3Rmo4GFj/NAo4Nrs3aUJOrzIX9+hrk+6/Vnw6EsJSBm0RNKZTSC1 ZZjijTLDXENPqGOUsuyXsAH/SJL+pntxGFen9yvkIMwnGum3hSTGg1bupS3BIjDo7VbK Qeg050+DQRepGaHsr3Gx7FKtaSeQ+umeUbl5XxAkAYQZj7PFt91R4PfieoopMJ0PKg43 CefGWPQf4opVeS3vtlkJsrPcsRf2s/tQA2aJLvuokcEqm80INNsmwDvv7u24wmASKqZD bkZRvPdmy6eixTKWO2z3Wq6MYDTln3HMk+/khOqRHbXYAIBrC7zPz9AsyYOSWzrYlDRU GqSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fy24-20020a170906b7d800b00a233508bc85si10537150ejb.848.2024.01.01.18.13.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 18:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13977-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A46311F21751 for ; Tue, 2 Jan 2024 02:13:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73FACECD; Tue, 2 Jan 2024 02:13:30 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (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 0E5C015C2; Tue, 2 Jan 2024 02:13:26 +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=01201311R251e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VziwJm._1704161598; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0VziwJm._1704161598) by smtp.aliyun-inc.com; Tue, 02 Jan 2024 10:13:19 +0800 Date: Tue, 2 Jan 2024 10:13:17 +0800 From: Tony Lu To: Markus Elfring Cc: 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 , Wen Gu , Wenjia Zhang , LKML Subject: Re: [PATCH 1/2] net/smc: Return directly after a failed kzalloc() in smc_fill_gid_list() Message-ID: Reply-To: Tony Lu References: <8ba404fd-7f41-44a9-9869-84f3af18fb46@web.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sun, Dec 31, 2023 at 03:58:15PM +0100, Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 31 Dec 2023 15:15:19 +0100 > > The kfree() function was called in one case by > the smc_fill_gid_list() function during error handling > even if the passed variable contained a null pointer. > This issue was detected by using the Coccinelle software. > > Thus return directly after a call of the function "kzalloc" failed > at the beginning. > > Signed-off-by: Markus Elfring LGTM, thank you. Also please add net tag in subject and fixes tag in commit body. Reviewed-by: Tony Lu > --- > net/smc/af_smc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c > index 7fc2f3c6d248..a396a9977ba9 100644 > --- a/net/smc/af_smc.c > +++ b/net/smc/af_smc.c > @@ -1180,7 +1180,7 @@ void smc_fill_gid_list(struct smc_link_group *lgr, > > alt_ini = kzalloc(sizeof(*alt_ini), GFP_KERNEL); > if (!alt_ini) > - goto out; > + return; > > alt_ini->vlan_id = lgr->vlan_id; > alt_ini->check_smcrv2 = true; > -- > 2.43.0