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: <20230923160353.42915-1-liuhaoran14@163.com>
Date:   Sun, 24 Sep 2023 00:03:53 +0800
From:   liuhaoran <liuhaoran14@....com>
To:     linux@...linux.org.uk
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        liuhaoran <liuhaoran14@....com>
Subject: [PATCH] arm: match-footbridge: Add error handling in dc21285_setup()

This patch adds error-handling for the allocate_resource()
inside the dc21285_setup().

Signed-off-by: liuhaoran <liuhaoran14@....com>
---
 arch/arm/mach-footbridge/dc21285.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index f8920d0010de..1970c66eb964 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -261,6 +261,7 @@ static struct notifier_block dc21285_pci_bus_nb = {
 int __init dc21285_setup(int nr, struct pci_sys_data *sys)
 {
 	struct resource *res;
+	int error;
 
 	res = kcalloc(2, sizeof(struct resource), GFP_KERNEL);
 	if (!res) {
@@ -273,10 +274,21 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
 	res[1].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
 	res[1].name  = "Footbridge prefetch";
 
-	allocate_resource(&iomem_resource, &res[1], 0x20000000,
+	error = allocate_resource(&iomem_resource, &res[1], 0x20000000,
 			  0xa0000000, 0xffffffff, 0x20000000, NULL, NULL);
+	if (error < 0) {
+		printk(KERN_ERR "%s: allocate_resource failed %d!"
+		       , __func__, error);
+		return 0;
+	}
+
 	allocate_resource(&iomem_resource, &res[0], 0x40000000,
 			  0x80000000, 0xffffffff, 0x40000000, NULL, NULL);
+	if (error < 0) {
+		printk(KERN_ERR "%s: allocate_resource failed %d!"
+		       , __func__, error);
+		return 0;
+	}
 
 	sys->mem_offset  = DC21285_PCI_MEM;
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ