public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>,
	hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: wmi: Make input buffer madatory when evaulating methods
Date: Wed, 7 Feb 2024 18:41:59 -0800	[thread overview]
Message-ID: <6360f90f-1aca-4355-aa19-661c2925dd24@linux.intel.com> (raw)
In-Reply-To: <20240207202012.3506-1-W_Armin@gmx.de>


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.

>
> 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?

>
> 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 <W_Armin@gmx.de>
> ---


With above fixed,

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

>  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
>
>
-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  reply	other threads:[~2024-02-08  2:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 20:20 [PATCH] platform/x86: wmi: Make input buffer madatory when evaulating methods Armin Wolf
2024-02-08  2:41 ` Kuppuswamy Sathyanarayanan [this message]
2024-02-08 18:22   ` Armin Wolf
2024-02-08 21:24     ` Kuppuswamy Sathyanarayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6360f90f-1aca-4355-aa19-661c2925dd24@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=W_Armin@gmx.de \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox