Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp452311rdb; Thu, 8 Feb 2024 10:23:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVj4/LI4o30wUhGUk4uI1xaw2W31Vo98jeAmEsxNGEp5I9z3XBOxfRkPiLc2UGnwUoPPy39npcw0GRA93HZhEcvyNaHdiv5j4gnkMODZA== X-Google-Smtp-Source: AGHT+IEM8JXbe0OqZXOqalg5IACqD2cP6o1UZG++GCJx+ZHky3QPJ6dE5uv1m96MK5O6nsDxuAp1 X-Received: by 2002:ac8:786:0:b0:42c:38fb:ac3c with SMTP id l6-20020ac80786000000b0042c38fbac3cmr29540qth.0.1707416595922; Thu, 08 Feb 2024 10:23:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707416595; cv=pass; d=google.com; s=arc-20160816; b=eRYtgF2b068GV9kuYnzA3ORUIxa4L1g2D4RnvRcpkgwPbl/HlM7Mx1cuqPk5dMXm1R iu0XydY8BJQ6WgcWzaw7wcR+GDGf+irPP2PV5wUBJrw4tV5aLWhtKXQPz3UnW3m0JPHc EBBp6fIhTX3K07RE1DhzF6cMFrcz9zul+erahoG9BhuATfoNQgvP8K6/bwlsf99avxxD GT0fG6fCiRcSLZro+XVsxHHhjCrYDW16S/DjH7TN0PothhQChKOlRjTz4BvEC7PPjKbL VXa0PhT4EQItKIjLfS8oh3wHF2NO956rNa5DuWEt0T6Qr8GtJQD8V8GTS9c+zvEOK1Qe 4izQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=kilNjiWzttVdk6d2SHFPexZoqxZXB/WXya/ATm72SAw=; fh=nEl+++9JoDI/tFYGMBdpCUEM4Dj+1tUgwiBcTxRu3tE=; b=VMsncSUBVa8zSqaiHhwtHXcOtocdNW7k34YuOUFRlLFO9PR7y1onBiTMofXBy70Yda xZGYW12GhZrnWdT1MQXyht2NShCLBg/W46Tc4SVg5WCYPo+FJ5L4nUVjjqTMGhpEvSdh 454DXjSp9dnVT5yruMwI/vpMN8Qr/wug4nP4Eb2WYurv+8fp+FtBzThtBvFN6OOhMx3v 7+4nUgjlNqaYceBcvq7IMBXqqHrD/OmTbd9Qk4YxWMSIw6Z2Ut8FTJMmJGEHyLGpljnd 0WoEm6SDfyDfWqWlNeLlBjL78jJmU1CtZ1HMl3VUKEXAcLbeUWy4WgkPk3UJXE6lTALh Ck9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=G7RzSa8p; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-58526-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58526-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de X-Forwarded-Encrypted: i=2; AJvYcCWZku2edQJgLqn4oi2YvYP3dbjUBe5+c1lMIK/yNGTZwjasoss0GEwFVPixD+nUIuQT5WQZhzXeCJxSKvEW8W8iD2Nfr9I1SePTe8kkRA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t3-20020a05622a148300b0042c2e9340d2si520791qtx.728.2024.02.08.10.23.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:23:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58526-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=G7RzSa8p; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-58526-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58526-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 89D441C24EA0 for ; Thu, 8 Feb 2024 18:23:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E21982D6E; Thu, 8 Feb 2024 18:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="G7RzSa8p" Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D5102E3FB; Thu, 8 Feb 2024 18:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707416586; cv=none; b=TyGFswecM1OJDIxDNgLEoSSj2tEQ/f/mKzMAAtZc9xB4bx9yanAu7LqGxM/RtPa2cXNHkywjanphokWsB+PQcCf5jC1qv/EjN5W9ZJY1ofEaKk3mbSLJhUzRnjut6LCStkhXL8GWIcSgNkrQSo/qSFa+Z1NIhqu7Dz67GZuVTTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707416586; c=relaxed/simple; bh=Z3M9OU1xg9hICr5Cd1CNiNl49J/c4bxrT2EwVHqITHc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MXPmNL24igmK1iV2hhfdGE+cXOugzw8e3AD7h/Hotn6ZwRox6EdYQsbaz8Jc/eAi7wlKME2kr2N9UaX0eUSTkoySGCPvlSSM1AdRxJeoycAVfYHMeT4CIOXj+6pIDaQQeQUjOA46EYVCv/JkpLN/Kaya02mR48eB76gaO5s1PMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=G7RzSa8p; arc=none smtp.client-ip=212.227.17.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1707416574; x=1708021374; i=w_armin@gmx.de; bh=Z3M9OU1xg9hICr5Cd1CNiNl49J/c4bxrT2EwVHqITHc=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=G7RzSa8pw0zfKQ+t54d5XNtwqX6aXz7YXTRFMse9fAXsm0hW/o6bEZvOjcW+PY1s KSKePHAgnCnVBQECLbI5Uw+a6Q1GiQEZVxLpLCvGfdn5b/LMxSLwF27cu0xdAp+5o UuKUHJ8nu1rIyP30fqW3q455C8tZ6Uc5Lc/M2I2EHYXEZPoBh2Zi2PIcKahPU6YeA smjrWDQa0PnGNZvNRRnC09eqsIgLOBDOHP7civWji8lOpySqFnfChAsywIqVsMvDv HmkXrRLdoHw/TFsmVfoaNEk/aZOYLdiSvFjDdj65MRGR0nSpavIhBHbosmcxJrvLl A9qvpvA9BzhE/ui2Rw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [141.30.226.129] ([141.30.226.129]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MLQxX-1rGt0o42YV-00IYBq; Thu, 08 Feb 2024 19:22:54 +0100 Message-ID: Date: Thu, 8 Feb 2024 19:22:52 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] platform/x86: wmi: Make input buffer madatory when evaulating methods To: Kuppuswamy Sathyanarayanan , hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240207202012.3506-1-W_Armin@gmx.de> <6360f90f-1aca-4355-aa19-661c2925dd24@linux.intel.com> Content-Language: en-US From: Armin Wolf In-Reply-To: <6360f90f-1aca-4355-aa19-661c2925dd24@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:7UPQzYOQx2ZRG1jce0S5xgoUoU14Bm1KLTiGsaVWK4ua6s75QSF 3CwsdFuu2EFLqOYSjoUnZLUat/KPii+j1VJ+YK0sKANpQDHuzBTxvY3zjdCQnG8ssLkeHSi W57vs+dg+laj+nzX4+UqGkxRTy9FaNXnzVuJAPXFEuRA4ljayl9MnoHJZRM+AW4jOMlYE3m KY6G7G6gkmw9fHpFM5TLA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:A8B7UDJo+kc=;4AstgXv6B2AcLkizu9bLEnXU+A6 DNW2zwgGZA5ngDuLPsAukxx81WzfMum/NCPd4hHzI2QjUEUbs7LKOf3+ABDYe0bNdzVxgqejb qhJG0uUyDLdwSDBbWTdJnKthdaHStoDoQEWqP1egbIBzb6QyDAIESB9QkjnWEla/203zfr7Xq Jqao5YEQcrEpczuGAFU1SqK60ItjQF9QJb3hD2mmrqu/DEENh9XONsEOVzIKpIdBunSO7tVPG BVbAu328Vw8putOApHfuRij/aEUBrTPHx7/K1cpbHaVXCiBKh5r7WgX+ExsfcrFC+1sJnZm1m hfMe/P22IC5lWZWe/H5qKgDelksMmPOicfN+NhLMB+ODF3Oeb9vFLBwUp2HOVORY0z+RIrhwp kJpwHxOVRmin/XeCcxbMJfkIigHE/kriouUzICRd+KikU5ZE7y1dju8dA1+RjQZcpseJ5TKVG VAX537pTgisohwt7vKvTeQRIBf6VVl6xoMgHLkSEo0Ig0lq5oHYnht+zm9Y9+zjscFJgu3auL j6fZH00gI6pmEYnfc/JNeyXYrBBYHBtBKLonznXUNuts1Lu3QDkOv1bVcHjPqVdPzGGppEwEN RMpFTULk7U9+WnEegtCO/c7mESf0/XqDs11SUgAFtV/3QFHsrDziOn4ixppJTgEuI6aKgXOKP ufd5McR4rjcXlXBJ7/D6V9yLojxZxgRzWaiGHqDK85r0JgW8sSSHavnvMllJQhZeArmiPgyhh Gdj3enEpX0EUPCO8dlrJTqSJ9U1HEOr72bFMY9gnxg+zfZydD5bVZMY8XTS+ePRAVUVxPb43t 1khYDVuj6VeAHN/LFOoLMsEUXV2H0F8E2Mpzw/iJEu+iQ= Am 08.02.24 um 03:41 schrieb Kuppuswamy Sathyanarayanan: > On 2/7/24 12:20 PM, Armin Wolf wrote: >> The ACPI-WMI specification declares that a WMxx control method takes >> 3 arguments: instance, method id and argument buffer. This is also >> the case even when the underlying WMI method does not have any >> input arguments. > It would be better if you include specification version and section > title for reference. The ACPI-WMI specification is not part of the ACPI specification. It consists of a single whitepaper published by Microsoft: https://github.com/microsoft/Windows-driver-samples/blob/main/wmi/wmiacpi/wmi-acpi.htm The section describing the ACPI control methods is called "ACPI Control Method Naming Conventions and Functionality for Windows 2000 Instrumentation". I do not thing that mentioning this in the commit message would be of any use. >> So if a WMI driver evaluates a WMI method without passing an input >> buffer, ACPICA will log a warning complaining that the third argument >> is missing. > I assume it is a compile warning. Can you copy the warning message? Its not a compiler warning. The ACPI control method is being evaluated at runtime, so the warning message will also be generated at runtime (when interpreting the AML bytecode). Thanks, Armin Wolf >> Prevent this by checking that a input buffer was passed, and return >> an error if this was not the case. >> >> Tested on a Asus PRIME B650-Plus. >> >> Signed-off-by: Armin Wolf >> --- > > With above fixed, > > Reviewed-by: Kuppuswamy Sathyanarayanan > >> drivers/platform/x86/wmi.c | 21 ++++++++++----------- >> 1 file changed, 10 insertions(+), 11 deletions(-) >> >> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c >> index 63906fdd0abf..f9e23d491dd9 100644 >> --- a/drivers/platform/x86/wmi.c >> +++ b/drivers/platform/x86/wmi.c >> @@ -296,7 +296,7 @@ EXPORT_SYMBOL_GPL(wmidev_instance_count); >> * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba >> * @instance: Instance index >> * @method_id: Method ID to call >> - * @in: Buffer containing input for the method call >> + * @in: Mandatory buffer containing input for the method call >> * @out: Empty buffer to return the method results >> * >> * Call an ACPI-WMI method, the caller must free @out. >> @@ -326,7 +326,7 @@ EXPORT_SYMBOL_GPL(wmi_evaluate_method); >> * @wdev: A wmi bus device from a driver >> * @instance: Instance index >> * @method_id: Method ID to call >> - * @in: Buffer containing input for the method call >> + * @in: Mandatory buffer containing input for the method call >> * @out: Empty buffer to return the method results >> * >> * Call an ACPI-WMI method, the caller must free @out. >> @@ -347,26 +347,25 @@ acpi_status wmidev_evaluate_method(struct wmi_device *wdev, u8 instance, u32 met >> block = &wblock->gblock; >> handle = wblock->acpi_device->handle; >> >> + if (!in) >> + return AE_BAD_DATA; >> + >> if (!(block->flags & ACPI_WMI_METHOD)) >> return AE_BAD_DATA; >> >> if (block->instance_count <= instance) >> return AE_BAD_PARAMETER; >> >> - input.count = 2; >> + input.count = 3; >> input.pointer = params; >> + >> params[0].type = ACPI_TYPE_INTEGER; >> params[0].integer.value = instance; >> params[1].type = ACPI_TYPE_INTEGER; >> params[1].integer.value = method_id; >> - >> - if (in) { >> - input.count = 3; >> - >> - params[2].type = get_param_acpi_type(wblock); >> - params[2].buffer.length = in->length; >> - params[2].buffer.pointer = in->pointer; >> - } >> + params[2].type = get_param_acpi_type(wblock); >> + params[2].buffer.length = in->length; >> + params[2].buffer.pointer = in->pointer; >> >> get_acpi_method_name(wblock, 'M', method); >> >> -- >> 2.39.2 >> >>