Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751859AbdITIJc (ORCPT ); Wed, 20 Sep 2017 04:09:32 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33526 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751833AbdITIJ1 (ORCPT ); Wed, 20 Sep 2017 04:09:27 -0400 X-Google-Smtp-Source: AOwi7QDK4a0KPeru2wWroXs1micDMNsRIvpvUznt8LOTzOum3xeavpGDyFhA+xSBDVJ/uNS/CCVCyQ== From: Arvind Yadav To: tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, vz@mleia.com, slemieux.tyco@gmail.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] irqchip/gic: Handle return value of kasprintf Date: Wed, 20 Sep 2017 13:38:21 +0530 Message-Id: <1505894901-9403-4-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505894901-9403-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1505894901-9403-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 799 Lines: 27 kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- 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