linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] PCI: acpiphp_ibm: potential uninitialized variable bug
@ 2016-04-15 14:51 Dan Carpenter
  2016-04-15 15:34 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-15 14:51 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Bjorn Helgaas, linux-acpi, linux-pci, linux-kernel,
	kernel-janitors

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;

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

* Re: [patch] PCI: acpiphp_ibm: potential uninitialized variable bug
  2016-04-15 14:51 [patch] PCI: acpiphp_ibm: potential uninitialized variable bug Dan Carpenter
@ 2016-04-15 15:34 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2016-04-15 15:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rafael J. Wysocki, Len Brown, Bjorn Helgaas, linux-acpi,
	linux-pci, linux-kernel, kernel-janitors

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

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

end of thread, other threads:[~2016-04-15 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 14:51 [patch] PCI: acpiphp_ibm: potential uninitialized variable bug Dan Carpenter
2016-04-15 15:34 ` Bjorn Helgaas

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