linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: arvind.yadav.cs@gmail.com (Arvind Yadav)
To: 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	[thread overview]
Message-ID: <1505894901-9403-4-git-send-email-arvind.yadav.cs@gmail.com> (raw)
In-Reply-To: <1505894901-9403-1-git-send-email-arvind.yadav.cs@gmail.com>

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@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

  parent reply	other threads:[~2017-09-20  8:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  8:08 [PATCH 0/4] iirqchip: Handle return value of kasprintf Arvind Yadav
2017-09-20  8:08 ` [PATCH 1/4] irqchip/gic-v3-its: " Arvind Yadav
2017-09-20  8:08 ` [PATCH 2/4] irqchip/gic-v3-its-platform-msi: " Arvind Yadav
2017-09-20  8:08 ` Arvind Yadav [this message]
2017-09-22  8:10 ` [PATCH 0/4] iirqchip: " Marc Zyngier
2017-09-22  8:57   ` Arvind Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505894901-9403-4-git-send-email-arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).