linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] iirqchip: Handle return value of kasprintf
@ 2017-09-20  8:08 Arvind Yadav
  2017-09-20  8:08 ` [PATCH 1/4] irqchip/gic-v3-its: " Arvind Yadav
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-09-20  8:08 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] irqchip/gic-v3-its: Handle return value of kasprintf
  2017-09-20  8:08 [PATCH 0/4] iirqchip: Handle return value of kasprintf Arvind Yadav
@ 2017-09-20  8:08 ` Arvind Yadav
  2017-09-20  8:08 ` [PATCH 2/4] irqchip/gic-v3-its-platform-msi: " Arvind Yadav
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-09-20  8:08 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] irqchip/gic-v3-its-platform-msi: Handle return value of kasprintf
  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 ` Arvind Yadav
  2017-09-20  8:08 ` [PATCH 3/4] irqchip/gic: " Arvind Yadav
  2017-09-22  8:10 ` [PATCH 0/4] iirqchip: " Marc Zyngier
  3 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-09-20  8:08 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] irqchip/gic: Handle return value of kasprintf
  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
  2017-09-22  8:10 ` [PATCH 0/4] iirqchip: " Marc Zyngier
  3 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-09-20  8:08 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/4] iirqchip: Handle return value of kasprintf
  2017-09-20  8:08 [PATCH 0/4] iirqchip: Handle return value of kasprintf Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-09-20  8:08 ` [PATCH 3/4] irqchip/gic: " Arvind Yadav
@ 2017-09-22  8:10 ` Marc Zyngier
  2017-09-22  8:57   ` Arvind Yadav
  3 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2017-09-22  8:10 UTC (permalink / raw)
  To: linux-arm-kernel

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/4] iirqchip: Handle return value of kasprintf
  2017-09-22  8:10 ` [PATCH 0/4] iirqchip: " Marc Zyngier
@ 2017-09-22  8:57   ` Arvind Yadav
  0 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-09-22  8:57 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-22  8:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/4] irqchip/gic: " Arvind Yadav
2017-09-22  8:10 ` [PATCH 0/4] iirqchip: " Marc Zyngier
2017-09-22  8:57   ` Arvind Yadav

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).