From patchwork Fri Jul 1 21:21:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 9210497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 943D1608A0 for ; Fri, 1 Jul 2016 21:23:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 862D9286B3 for ; Fri, 1 Jul 2016 21:23:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AC54286CC; Fri, 1 Jul 2016 21:23:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18FBA286CD for ; Fri, 1 Jul 2016 21:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752441AbcGAVWQ (ORCPT ); Fri, 1 Jul 2016 17:22:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbcGAVWP (ORCPT ); Fri, 1 Jul 2016 17:22:15 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06CB51176BC; Fri, 1 Jul 2016 21:21:28 +0000 (UTC) Received: from fidelio.ahs3.com (ovpn-116-22.phx2.redhat.com [10.3.116.22]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u61LLPkO003914; Fri, 1 Jul 2016 17:21:27 -0400 From: Al Stone To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ahs3@redhat.com, "Rafael J . Wysocki" , Len Brown Subject: [PATCH 1/3] ACPI: fix incorrect counts returned by acpi_parse_entries_array() Date: Fri, 1 Jul 2016 15:21:19 -0600 Message-Id: <1467408081-7418-2-git-send-email-ahs3@redhat.com> In-Reply-To: <1467408081-7418-1-git-send-email-ahs3@redhat.com> References: <1467408081-7418-1-git-send-email-ahs3@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 01 Jul 2016 21:21:28 +0000 (UTC) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The static function acpi_parse_entries_array() is provided an array of type struct acpi_subtable_proc that has a callback function and a count. The count should reflect how many times the callback has been successfully called. However, the current code only increments the 0th element of the array, regardless of the number of entries in the array, or which callback has been invoked. The fix is to use the index into the array, instead of a pointer to the beginning of the array. Signed-off-by: Al Stone Cc: Rafael J. Wysocki Cc: Len Brown --- drivers/acpi/tables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 9f0ad6e..3e167b4 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -281,7 +281,7 @@ acpi_parse_entries_array(char *id, unsigned long table_size, proc[i].handler(entry, table_end)) return -EINVAL; - proc->count++; + proc[i].count++; break; } if (i != proc_num) @@ -416,7 +416,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler) return -ENODEV; } -/* +/* * The BIOS is supposed to supply a single APIC/MADT, * but some report two. Provide a knob to use either. * (don't you wish instance 0 and 1 were not the same?)