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: <20230607093730.18982-1-jiasheng@iscas.ac.cn>
Date:   Wed,  7 Jun 2023 17:37:30 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     james.smart@...adcom.com, ram.vegesna@...adcom.com,
        jejb@...ux.ibm.com, martin.petersen@...cle.com,
        chenzhongjin@...wei.com, dwagner@...e.de, hare@...e.de
Cc:     linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
        linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] scsi: efct: Add missing check for ioremap

Add check for ioremap() and return the error if it fails in order to
guarantee the success of ioremap().

Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/scsi/elx/efct/efct_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c
index 49fd2cfed70c..77c6252dcb3e 100644
--- a/drivers/scsi/elx/efct/efct_driver.c
+++ b/drivers/scsi/elx/efct/efct_driver.c
@@ -528,6 +528,8 @@ efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
 			efct->reg[r] = ioremap(pci_resource_start(pdev, i),
 					       pci_resource_len(pdev, i));
+			if (!efct->reg[r])
+				goto ioremap_out;
 			r++;
 		}
 
@@ -580,7 +582,7 @@ efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	efct_teardown_msix(efct);
 dma_mask_out:
 	pci_set_drvdata(pdev, NULL);
-
+ioremap_out:
 	for (i = 0; i < EFCT_PCI_MAX_REGS; i++) {
 		if (efct->reg[i])
 			iounmap(efct->reg[i]);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ