[PATCH 3/4] irqchip/gic: Handle return value of kasprintf

Arvind Yadav arvind.yadav.cs at gmail.com
Wed Sep 20 01:08:21 PDT 2017


kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs at gmail.com>
---
 drivers/irqchip/irq-gic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 651d726..ec4a7e6 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -1209,9 +1209,13 @@ static int __init __gic_init_bases(struct gic_chip_data *gic,
 
 	if (static_key_true(&supports_deactivate) && gic == &gic_data[0]) {
 		name = kasprintf(GFP_KERNEL, "GICv2");
+		if (!name)
+			return -ENOMEM;
 		gic_init_chip(gic, NULL, name, true);
 	} else {
 		name = kasprintf(GFP_KERNEL, "GIC-%d", (int)(gic-&gic_data[0]));
+		if (!name)
+			return -ENOMEM;
 		gic_init_chip(gic, NULL, name, false);
 	}
 
-- 
1.9.1




More information about the linux-arm-kernel mailing list