* [PATCH] PCI/ACPI: Check acpi_resource_to_address64() return value
@ 2013-05-09 19:29 Bjorn Helgaas
2013-05-09 19:45 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Helgaas @ 2013-05-09 19:29 UTC (permalink / raw)
To: linux-pci; +Cc: Rafael J. Wysocki, linux-acpi
We should check the acpi_resource_to_address64() return value, which
also removes the need to validate the resource type beforehand.
No functional change.
Found by Coverity (CID 113815).
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/acpi/pci_root.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ac8688b..c956434 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -100,13 +100,12 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
{
struct resource *res = data;
struct acpi_resource_address64 address;
+ acpi_status status;
- if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
- resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
- resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
+ status = acpi_resource_to_address64(resource, &address);
+ if (ACPI_FAILURE(status))
return AE_OK;
- acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE)) {
res->start = address.minimum;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI/ACPI: Check acpi_resource_to_address64() return value
2013-05-09 19:29 [PATCH] PCI/ACPI: Check acpi_resource_to_address64() return value Bjorn Helgaas
@ 2013-05-09 19:45 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2013-05-09 19:45 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-acpi
On Thursday, May 09, 2013 01:29:13 PM Bjorn Helgaas wrote:
> We should check the acpi_resource_to_address64() return value, which
> also removes the need to validate the resource type beforehand.
> No functional change.
>
> Found by Coverity (CID 113815).
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/pci_root.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index ac8688b..c956434 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -100,13 +100,12 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
> {
> struct resource *res = data;
> struct acpi_resource_address64 address;
> + acpi_status status;
>
> - if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
> - resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
> - resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
> + status = acpi_resource_to_address64(resource, &address);
> + if (ACPI_FAILURE(status))
> return AE_OK;
>
> - acpi_resource_to_address64(resource, &address);
> if ((address.address_length > 0) &&
> (address.resource_type == ACPI_BUS_NUMBER_RANGE)) {
> res->start = address.minimum;
>
> --
> 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
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-09 19:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-09 19:29 [PATCH] PCI/ACPI: Check acpi_resource_to_address64() return value Bjorn Helgaas
2013-05-09 19:45 ` Rafael J. Wysocki
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).