[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180424071036.20188-1-yuehaibing@huawei.com>
Date: Tue, 24 Apr 2018 15:10:36 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: <tglx@...utronix.de>, <jason@...edaemon.net>,
<marc.zyngier@....com>
CC: <linux-kernel@...r.kernel.org>, YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH] irqchip/gic-v3: check kasprintf() for failures
We should just return -ENOMEM here if the allocation fails,
otherwise it may cause a panic.
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
drivers/irqchip/irq-gic-v3-its-pci-msi.c | 3 +++
drivers/irqchip/irq-gic-v3-its-platform-msi.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index 25a98de..ef3911f 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -160,6 +160,9 @@ its_pci_msi_parse_madt(struct acpi_subtable_header *header,
its_entry = (struct acpi_madt_generic_translator *)header;
node_name = kasprintf(GFP_KERNEL, "ITS@...lx",
(long)its_entry->base_address);
+ if(!node_name)
+ return -ENOMEM;
+
dom_handle = iort_find_domain_token(its_entry->translation_id);
if (!dom_handle) {
pr_err("%s: Unable to locate ITS domain handle\n", node_name);
diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c
index 8881a05..b676fb4 100644
--- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c
@@ -126,6 +126,9 @@ its_pmsi_parse_madt(struct acpi_subtable_header *header,
its_entry = (struct acpi_madt_generic_translator *)header;
node_name = kasprintf(GFP_KERNEL, "ITS@...lx",
(long)its_entry->base_address);
+ if(!node_name)
+ return -ENOMEM;
+
domain_handle = iort_find_domain_token(its_entry->translation_id);
if (!domain_handle) {
pr_err("%s: Unable to locate ITS domain handle\n", node_name);
--
2.7.0
Powered by blists - more mailing lists