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


Groups > linux.kernel > #1379890 > unrolled thread

[patch] PCI: acpiphp_ibm: potential uninitialized variable bug

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-04-15 17:00 +0200
Last post2016-04-15 17:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch] PCI: acpiphp_ibm: potential uninitialized variable bug Dan Carpenter <dan.carpenter@oracle.com> - 2016-04-15 17:00 +0200
    Re: [patch] PCI: acpiphp_ibm: potential uninitialized variable bug Bjorn Helgaas <helgaas@kernel.org> - 2016-04-15 17:40 +0200

#1379890 — [patch] PCI: acpiphp_ibm: potential uninitialized variable bug

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-04-15 17:00 +0200
Subject[patch] PCI: acpiphp_ibm: potential uninitialized variable bug
Message-ID<rodnY-4BO-9@gated-at.bofh.it>
If ibm_get_table_from_acpi() fails then "table" isn't initialized.  I
fixed this by adding a check for failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 2f6d3a1..f6221d7 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -138,6 +138,8 @@ static union apci_descriptor *ibm_slot_from_id(int id)
 	char *table;
 
 	size = ibm_get_table_from_acpi(&table);
+	if (size < 0)
+		return NULL;
 	des = (union apci_descriptor *)table;
 	if (memcmp(des->header.sig, "aPCI", 4) != 0)
 		goto ibm_slot_done;

[toc] | [next] | [standalone]


#1379925

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-04-15 17:40 +0200
Message-ID<roe0F-5dC-15@gated-at.bofh.it>
In reply to#1379890
On Fri, Apr 15, 2016 at 05:51:06PM +0300, Dan Carpenter wrote:
> If ibm_get_table_from_acpi() fails then "table" isn't initialized.  I
> fixed this by adding a check for failure.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to pci/hotplug for v4.7, thanks, Dan!

> diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
> index 2f6d3a1..f6221d7 100644
> --- a/drivers/pci/hotplug/acpiphp_ibm.c
> +++ b/drivers/pci/hotplug/acpiphp_ibm.c
> @@ -138,6 +138,8 @@ static union apci_descriptor *ibm_slot_from_id(int id)
>  	char *table;
>  
>  	size = ibm_get_table_from_acpi(&table);
> +	if (size < 0)
> +		return NULL;
>  	des = (union apci_descriptor *)table;
>  	if (memcmp(des->header.sig, "aPCI", 4) != 0)
>  		goto ibm_slot_done;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web