Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735612 > unrolled thread

[PATCH 0/4] iirqchip: Handle return value of kasprintf

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-09-20 10:10 +0200
Last post2017-09-22 11:00 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] iirqchip: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 10:10 +0200
    [PATCH 3/4] irqchip/gic: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 10:10 +0200
    [PATCH 1/4] irqchip/gic-v3-its: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 10:10 +0200
    [PATCH 2/4] irqchip/gic-v3-its-platform-msi: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 10:10 +0200
    Re: [PATCH 0/4] iirqchip: Handle return value of kasprintf Marc Zyngier <marc.zyngier@arm.com> - 2017-09-22 10:20 +0200
      Re: [PATCH 0/4] iirqchip: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-22 11:00 +0200

#1735612 — [PATCH 0/4] iirqchip: Handle return value of kasprintf

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-20 10:10 +0200
Subject[PATCH 0/4] iirqchip: Handle return value of kasprintf
Message-ID<urIf0-kT-5@gated-at.bofh.it>
kasprintf() can fail here and we must check its return value.

Arvind Yadav (4):
  [PATCH 1/4] irqchip/gic-v3-its: Handle return value of kasprintf
  [PATCH 2/4] irqchip/gic-v3-its-platform-msi: Handle return value of kasprintf
  [PATCH 3/4] irqchip/gic: Handle return value of kasprintf
  [PATCH 4/4] irqchip/lpc32xx: Handle return value of kasprintf

 drivers/irqchip/irq-gic-v3-its-pci-msi.c      | 3 +++
 drivers/irqchip/irq-gic-v3-its-platform-msi.c | 3 +++
 drivers/irqchip/irq-gic.c                     | 4 ++++
 drivers/irqchip/irq-lpc32xx.c                 | 5 +++++
 4 files changed, 15 insertions(+)

-- 
1.9.1

[toc] | [next] | [standalone]


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

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-20 10:10 +0200
Subject[PATCH 3/4] irqchip/gic: Handle return value of kasprintf
Message-ID<urIf0-kT-13@gated-at.bofh.it>
In reply to#1735612
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

[toc] | [prev] | [next] | [standalone]


#1735614 — [PATCH 1/4] irqchip/gic-v3-its: Handle return value of kasprintf

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-20 10:10 +0200
Subject[PATCH 1/4] irqchip/gic-v3-its: Handle return value of kasprintf
Message-ID<urIf0-kT-17@gated-at.bofh.it>
In reply to#1735612
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-v3-its-pci-msi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index 14a8c0a..f703069 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -158,6 +158,9 @@ static int __init its_pci_of_msi_init(void)
 	its_entry = (struct acpi_madt_generic_translator *)header;
 	node_name = kasprintf(GFP_KERNEL, "ITS@0x%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);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1735616 — [PATCH 2/4] irqchip/gic-v3-its-platform-msi: Handle return value of kasprintf

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-20 10:10 +0200
Subject[PATCH 2/4] irqchip/gic-v3-its-platform-msi: Handle return value of kasprintf
Message-ID<urIf0-kT-21@gated-at.bofh.it>
In reply to#1735612
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-v3-its-platform-msi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c
index 833a90f..a731f82 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 @@ static int __init its_pmsi_init_one(struct fwnode_handle *fwnode,
 	its_entry = (struct acpi_madt_generic_translator *)header;
 	node_name = kasprintf(GFP_KERNEL, "ITS@0x%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);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1737259

FromMarc Zyngier <marc.zyngier@arm.com>
Date2017-09-22 10:20 +0200
Message-ID<usrlM-3MM-7@gated-at.bofh.it>
In reply to#1735612
On Wed, Sep 20 2017 at  1:38:18 pm BST, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
> kasprintf() can fail here and we must check its return value.

Or not. The use of these strings is purely cosmetic (they are only used
to display various debug information), and printk is perfectly able to
handle a NULL string.

Refusing to probe an essential piece of HW because a debug feature
failed seems at best counter-productive.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny.

[toc] | [prev] | [next] | [standalone]


#1737296

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-22 11:00 +0200
Message-ID<usrYv-3Z9-27@gated-at.bofh.it>
In reply to#1737259
Hi Marc,

On Friday 22 September 2017 01:40 PM, Marc Zyngier wrote:
> On Wed, Sep 20 2017 at  1:38:18 pm BST, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
>> kasprintf() can fail here and we must check its return value.
> Or not. The use of these strings is purely cosmetic (they are only used
> to display various debug information), and printk is perfectly able to
> handle a NULL string.
>
> Refusing to probe an essential piece of HW because a debug feature
> failed seems at best counter-productive.
Yes, Your are right. Sorry for noise. :)
> Thanks,
>
> 	M.
~arvind

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web