From patchwork Thu May 9 19:29:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 2545321 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 556FC3FE37 for ; Thu, 9 May 2013 19:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718Ab3EIT3Q (ORCPT ); Thu, 9 May 2013 15:29:16 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:38511 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752632Ab3EIT3P (ORCPT ); Thu, 9 May 2013 15:29:15 -0400 Received: by mail-ie0-f181.google.com with SMTP id x12so6377357ief.12 for ; Thu, 09 May 2013 12:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:subject:to:from:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=EdVof81X90qINrHmwrIhoh0ehPPNNGxaRL+vGXwNhVs=; b=HcjAokAJXYbjyoJVYHDy7Qpwy8WMSpNx/Rd2Us5ECuCp5exwcPkbKkqB1HryLMQV/k JxVIjDKYzUf0CKBRWsiMdJlxGYKIYaIdkXUI91zJoeqvauK/1b4urB2jtHHeifq9dTYx Tcu07py999vLYhfNhE14z3gHrP2pM2T6lOUhlZ2uGNzqi+vDoX3RkNICo0153WU2z1RY An6CMvwVqA0xRzCEw/J+JzPqgdZOx5faaRVNR6HVoR4apQZGCDsxUwwfRWJNbYXFYab8 9/TQLJTmQre7FgK75zKrixzCRLy7yiO8EZJPY7qEeBP0XqsOzMIfD51MjnmnbJRZ1FSq 6gyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:subject:to:from:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=EdVof81X90qINrHmwrIhoh0ehPPNNGxaRL+vGXwNhVs=; b=kWSZjuupYAYdgjfIRXv0ohtPL61yrvWcGjDbHKFcbVnWlSA59guAHeU4QfCwXEQefX jESpshdYQaIVCyLaWM4x5F47fyXRoDaEMu8VZlvfD1u9QZW8KitzfY0PoWpLqHswCRCN +AXuin/xDsULBXH4CUsYCuHvtn1Iw7g7Ku8EGt9sDnEPBXRdfxlRlhDK7eHYjuoGAtl0 QaZUpRmMI9PPLq3vAn1yyOF3A+nuxgRVc7Bl6RWYlIiFdiYP4JL7fcEpL+KHG1Sp+9uW BiFUYQWCl7m7PhOHPzDXTdCn8MlSHOShSz7MW43kdORGk9MTQnGHK2l0R8ffq5XwjYU1 IeJw== X-Received: by 10.50.36.229 with SMTP id t5mr9462267igj.18.1368127754960; Thu, 09 May 2013 12:29:14 -0700 (PDT) Received: from localhost ([172.29.121.99]) by mx.google.com with ESMTPSA id ua6sm8927612igb.0.2013.05.09.12.29.13 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 May 2013 12:29:14 -0700 (PDT) Subject: [PATCH] PCI/ACPI: Check acpi_resource_to_address64() return value To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Date: Thu, 09 May 2013 13:29:13 -0600 Message-ID: <20130509192913.17473.94947.stgit@bhelgaas-glaptop> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmgqr7K8Svn2kvs9ZdHFEdF0RrtELjh6HCAtLF8yPaGiY8EYx7AXCC0c67I1tcnIewFILjKQxC0zSoWIKDVglbrO8CbwTP1ncHvWPsycO+ylI40Q7XCTivqDfc4R2a9dGxNV8iJIX2vf/jbWc1McwxtIyBDW21uTbPCTWFYN3r0vqSef7q4KjYNw0yTFeAGAGbGIVJtxtVEJ2QZYfktKDAy0xpiptEq/r+Jfjf6Kb55A5mI5jM= Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 Acked-by: Rafael J. Wysocki --- drivers/acpi/pci_root.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;