From patchwork Sat Aug 12 07:44:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 9896925 X-Patchwork-Delegate: andy.shevchenko@gmail.com 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 0754160236 for ; Sat, 12 Aug 2017 07:46:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF5EC28B40 for ; Sat, 12 Aug 2017 07:46:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E47B528BB9; Sat, 12 Aug 2017 07:46:15 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 A99DF28B40 for ; Sat, 12 Aug 2017 07:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750891AbdHLHqA (ORCPT ); Sat, 12 Aug 2017 03:46:00 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34744 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbdHLHp6 (ORCPT ); Sat, 12 Aug 2017 03:45:58 -0400 Received: by mail-wm0-f66.google.com with SMTP id x64so8710635wmg.1; Sat, 12 Aug 2017 00:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LljidV+55S7bY6fSdYMCKlqrRfJd6e6toHHoGg6AZGg=; b=aMGTh8aCLcHY8awTGBDJ74pU3wVocAUl+1aqJWb1CFieuYI45kNfz+JMpV6skQt01v qpbleuSp3M7zZGSK440+sBD48YsYZKaZNVxzkH7sX743xaIP0yfkSrezIZWjikW+zOLJ mB2eSGbNanSXF+VB7oIgMafwCf+9nuqb0EWDuZtE+mQCzEZSmQs8JuFX7YaXoIj+rhYy uMgho8NUOUjhY9dLVfHgEcbGT8r2503z/ZrK9dFumXmtdQyXiX+URWmBID87vMoIYnKF D+P/cpaxGyVuFOABGGFW0ZOYEF2DZPCweJULw/eYh+6IPMEMe2GZA9zrVj0dSa/xibHD Zddg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LljidV+55S7bY6fSdYMCKlqrRfJd6e6toHHoGg6AZGg=; b=P1P3UYYaI6vsB4YCObirT2XTZC8PdYVwKOKp3Xn8wUm2MLo6sXieulCV5hcDqA7QZY MVa8CE4EZ+yrGb3EeCV5qrUBqgh4MxDOeaUNjvaIiLLpifL2m+Qyt06QacoiB0SqsaLt xLH9bTdjflENySdjJt0aO9BMnq9+zGjk/CLmWPpTfX5eDbp/PcdVpPd1x431FA2dECkH mrf9N/benLTVAN1M1SAeUiVYNT7kuanGx0Dkr4ZOM1mINpz8Gpbrq+ycxgxIe9vQnUPE u0UJqyNO7vl//+HxpA+M7Nlseg87pXcmDqlt3b5LdwlgV3wR8zSNRuWNL8J2XTjtcjej n6xw== X-Gm-Message-State: AHYfb5ioiwU8gxyuBRGvKBQX5mhsOHP9FMrGUwgN1g/eL8DzEa+mzDNM AlNX5oeuML7rmg== X-Received: by 10.28.72.212 with SMTP id v203mr821916wma.2.1502523957551; Sat, 12 Aug 2017 00:45:57 -0700 (PDT) Received: from Pali-Latitude.lan (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id d200sm651526wmd.32.2017.08.12.00.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 00:45:56 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Corentin Chary , Darren Hart , Andy Shevchenko Cc: acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 4/4] platform/x86: wmi: Fix check for method instance number Date: Sat, 12 Aug 2017 09:44:18 +0200 Message-Id: <1502523858-25716-5-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1502523858-25716-1-git-send-email-pali.rohar@gmail.com> References: <1502523858-25716-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP instance_count defines number of instances of data block and instance itself is indexed from zero, which means first instance has number 0. Therefore check for invalid instance should be non-strict inequality. Signed-off-by: Pali Rohár Reviewed-by: Darren Hart (VMware) --- drivers/platform/x86/wmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index e32ba57..0765b17 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -218,7 +218,7 @@ acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, if (!(block->flags & ACPI_WMI_METHOD)) return AE_BAD_DATA; - if (block->instance_count < instance) + if (block->instance_count <= instance) return AE_BAD_PARAMETER; input.count = 2; @@ -265,7 +265,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance, block = &wblock->gblock; handle = wblock->acpi_device->handle; - if (block->instance_count < instance) + if (block->instance_count <= instance) return AE_BAD_PARAMETER; /* Check GUID is a data block */ @@ -392,7 +392,7 @@ acpi_status wmi_set_block(const char *guid_string, u8 instance, block = &wblock->gblock; handle = wblock->acpi_device->handle; - if (block->instance_count < instance) + if (block->instance_count <= instance) return AE_BAD_PARAMETER; /* Check GUID is a data block */