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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4616e325-e313-4078-9788-dd1e6e51b9e0@web.de>
Date: Thu, 28 Dec 2023 15:48:14 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-scsi@...r.kernel.org, kernel-janitors@...r.kernel.org,
 "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: ses: Move a label in ses_enclosure_data_process()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 28 Dec 2023 15:38:09 +0100

The kfree() function was called in up to three cases by
the ses_enclosure_data_process() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.

* Thus move the label “simple_populate” behind this kfree() call.

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

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

diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index d7d0c35c58b8..e98f47d8206f 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -528,7 +528,7 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
 				       int create)
 {
 	u32 result;
-	unsigned char *buf = NULL, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL;
+	unsigned char *buf, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL;
 	int i, j, page7_len, len, components;
 	struct ses_device *ses_dev = edev->scratch;
 	int types = ses_dev->page1_num_types;
@@ -552,8 +552,8 @@ static void ses_enclosure_data_process(struct enclosure_device *edev,
 		goto simple_populate;
 	result = ses_recv_diag(sdev, 7, buf, len);
 	if (result) {
- simple_populate:
 		kfree(buf);
+simple_populate:
 		buf = NULL;
 		desc_ptr = NULL;
 		len = 0;
--
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ