From patchwork Thu Dec 28 17:24:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 759799 Received: from mout.web.de (mout.web.de [212.227.17.11]) (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 83E19F9C1; Thu, 28 Dec 2023 17:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="woj0ouMH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703784246; x=1704389046; i=markus.elfring@web.de; bh=4XlxHJDHSmu9DTtlturBDNHee1wz7AQbL0bmz7RZbq0=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=woj0ouMHLYY7ibHMUL64iTcnX7olMYiuDthJKiG0aiwdNFxCjFdWrJdmvRen4gYg SHqbn57hkBus4CTgbjtjLaJ9uYCutP+KzqWHQCBerfHQm1s+osrG6x7P0asxx4yRB IUK1eK5Hfcx7zjJ9x2qjlLd/swBA3fJjo6D0ALXdjFONd/x4z8iDMVkKPXiPJZjjZ Y+up3bOXLWNUEq8DFeH1jiF0MuUI2eeN8pBjudwmbr8XU0tMxwojjUHkHICCjQwV8 BpMv3idkQvYY7YGDDFtgXsucVClXHIdwsVqrDJl7WP0PoU8Q6KaIWxBkQHQWlDRon xFN9fqGKIL8B4gPBzQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M43GU-1rIu7439Si-000Ft3; Thu, 28 Dec 2023 18:24:06 +0100 Message-ID: Date: Thu, 28 Dec 2023 18:24:05 +0100 Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/4] scsi: lpfc: Return directly after a failed kzalloc() in lpfc_sli_read_link_ste() Content-Language: en-GB From: Markus Elfring To: linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org, Dick Kennedy , James Smart , "James E. J. Bottomley" , "Martin K. Petersen" Cc: LKML References: <48a127e8-ca4f-4fc4-81b7-226080fba720@web.de> In-Reply-To: <48a127e8-ca4f-4fc4-81b7-226080fba720@web.de> X-Provags-ID: V03:K1:uIeGhHJ9SX2ZMZpWX85Jqs1cor36TOwqWrCC1YmAOQ9bZYmxpo9 JaxrzdcpwFOx6pDeiYXUJbUUa6Qq3lLprlWCa+GnuKzgMrGr2kkeVmkV3qwZZD0N1dGu1cs fMnEjuqBqYXQzIOxXKkZqD5NjYFmufdbCGiG651kYOGxzrmxo3S7VkejiLxUHvYBvGH0s8p a25p4oBUcrSr2I+Q+VdVQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:DmmwTBIHlcM=;+v8eqOTTMeJo2NnLUZzwP3IWP/U ebNYeII958j7OGFbNxPZaxR4ksv6TRTf4qOwfmKCpPtsT5hhlIgK9jAHu9NRM6rmXKlEGz1gJ ClIAwTWUbrYJaagSyo893Nh6Ce2/eJzlJ2/7LkFxdIv+Ks4Orlt0yWA7DD84TRTYFfysn83nb vDIgDTivGvYhtcjaH9p2BCBNpuSShzjiPQMpSnEV62wCSagWzlOBvfzImxcDXDoC2mDqZDBOl sEkxmmOGuncbGXraij6wG+vJi9L7D9D/Uppe2DikDMdP7r2bnES/JUFQhdtbmj5BCAB7Rl2ww +jiKDXSwDQWF4hY/iYm9oAi8koYDSJHhXDfDbHufklpFfTtvnnJO9H6Q0q12J0R0h1lytT6DY BH0Ng72TXIdzny7QGJgzpC/QJGK0rgy1tXJsLi/gSAN0Fyv3WL4DKt5OD3LC5BywNvA6drnvb rtDo0qv21wQRbKePmjv2nMutGU34+kf8wkLb49wDnEYKY3SjxfjIjAPt6QsL9GZRIMKqwhdPR HGeK+BU2DZqpT7qD5IYGQDEna1BELAURaP1vGGD8CqpqBZIky5786mh97wbTyhl5kXqae0Z0C L9evAfZAvfAyMrqJyjCYOx4+wTIDmDgJkoeEA5iVi/GREwiOE30blI32RfuvkBGMFtRZ419LU 8OzUEcrWIunzV2iuyeA9ViOxw0jzPV1+anSGOaee0fioWLA3FL/4wSV3gBdq/iLfOCGjoL7ek TImXNxf6QCqd4m3kzVcPJsFWyOgtwImVVl60YQbweA6UkBsfL/yqkxzSd8Q7zf55HHm8qrJpP vCQmqbqSmFVvR1Ij0FVFsjOtT1eOPCe6/4Jb6VcchH/Tk5XPUKiR4+pxm13gknqnH8Tru8bv5 xIGK5RMXE+CsAVhdT1nBbceIt3sJh1JVGzViLWAxPYshRwrBpGqywbeHJ4l19IRAe45qPJbGi wIlz9A== From: Markus Elfring Date: Thu, 28 Dec 2023 17:13:50 +0100 The kfree() function was called in one case by the lpfc_sli_read_link_ste() 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 --- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 706985358c6a..93339425ce3c 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -20701,7 +20701,7 @@ lpfc_sli_read_link_ste(struct lpfc_hba *phba) /* Get adapter Region 23 data */ rgn23_data = kzalloc(DMP_RGN23_SIZE, GFP_KERNEL); if (!rgn23_data) - goto out; + return; if (phba->sli_rev < LPFC_SLI_REV4) data_size = lpfc_sli_get_config_region23(phba, rgn23_data);