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: 2545331 Return-Path: X-Original-To: patchwork-linux-acpi@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 6F1813FE81 for ; Thu, 9 May 2013 19:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632Ab3EIT3R (ORCPT ); Thu, 9 May 2013 15:29:17 -0400 Received: from mail-ie0-f171.google.com ([209.85.223.171]:35560 "EHLO mail-ie0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752590Ab3EIT3P (ORCPT ); Thu, 9 May 2013 15:29:15 -0400 Received: by mail-ie0-f171.google.com with SMTP id e11so6348177iej.16 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=ISgF3UpimuDh6pR+64C8lAIR2II3OdTrnf8R7S0YPhJCqOwXwF9uALdaD6fYCJXYwu 5QMN3wgSTpwkzyNxDvVYK8hyCeZ2Bdbt0HDIBEFfwFY05HQIxUqbAlNSlSyVQrjW0l2q ofprmNBa7/oLJU8oQeZeCwKK/55I5hT9Oi4dcFG6OTsnW2RIEpaNtTGWMJRH44/j3AQ6 RoQOqMZ4gKFjyz39axzXAy7YoxYj16I8S0I7Bj+p6VlcqN6EZZQ+jNuxGPPul0DjACwT 8HiFaN30ZZ5DTizCbPwxk5k1StWzMhqE2hjottH5+jyK7Wa52Ncmn9NLcX1jud3g+znT N2Sw== 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: ALoCoQk4z7lVtCQRu+zfVFRdmKIZ1DNS2m2VX1YvEpNa1T7OTHkj80LKKZxlKoviBgTuR1PRRXAX/S2mStV70F7bkv0eFz5jYt2+e2nliW0rjMcftqfgomXqamKDMIDx4X2J8ZwCm5/BDHYS/0QVf/dhOQ8t58Y8ChfXs709RO5uoGtVCKR6WbpMqKGO8B/gdczdmx0ZpqNOWJfqecvJxYbZjbtgTwW76A== Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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-acpi" 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;