lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ba1c555a-6ddd-455f-862c-f1cb21e4ef8f@web.de>
Date: Thu, 28 Dec 2023 13:05:15 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-scsi@...r.kernel.org, kernel-janitors@...r.kernel.org,
 Hannes Reinecke <hare@...e.de>, "James E. J. Bottomley"
 <jejb@...ux.ibm.com>, "Martin K. Petersen" <martin.petersen@...cle.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] scsi: fcoe: Return directly after a failed kzalloc() in
 fcoe_sysfs_fcf_add()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 28 Dec 2023 12:34:41 +0100

The kfree() function was called in one case by
the fcoe_sysfs_fcf_add() 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.

* Delete an initialisation for the variable “rc”
  which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/scsi/fcoe/fcoe_ctlr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 19eee108db02..df7c8f68596e 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -163,14 +163,14 @@ static int fcoe_sysfs_fcf_add(struct fcoe_fcf *new)
 	struct fcoe_ctlr *fip = new->fip;
 	struct fcoe_ctlr_device *ctlr_dev;
 	struct fcoe_fcf_device *temp, *fcf_dev;
-	int rc = -ENOMEM;
+	int rc;

 	LIBFCOE_FIP_DBG(fip, "New FCF fab %16.16llx mac %pM\n",
 			new->fabric_name, new->fcf_mac);

 	temp = kzalloc(sizeof(*temp), GFP_KERNEL);
 	if (!temp)
-		goto out;
+		return -ENOMEM;

 	temp->fabric_name = new->fabric_name;
 	temp->switch_name = new->switch_name;
--
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ