Re: [PATCH v6 03/13] platform/x86: lenovo-wmi-other: Zero initialize WMI arguments

From: Rong Zhang

Date: Wed Apr 01 2026 - 14:39:20 EST


Hi Derek,

On Tue, 2026-03-31 at 18:11 +0000, Derek J. Clark wrote:
> Adds explicit initialization of wmi_method_args_32 declarations with
> zero values to prevent uninitialized data from being sent to the WMI
> device when passed.
>
> Suggested-by: Rong Zhang <i@xxxxxxxx>
> Signed-off-by: Derek J. Clark <derekjohn.clark@xxxxxxxxx>

Add a Fixes: tag if applicable?

If you decide to add it, fix patches should be the very first patches in
the series so that they can be backported painlessly. See also my reply
to the cover letter.

> ---
> drivers/platform/x86/lenovo/wmi-other.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/lenovo/wmi-other.c b/drivers/platform/x86/lenovo/wmi-other.c
> index c1728c7c2957..c3614bc4f90c 100644
> --- a/drivers/platform/x86/lenovo/wmi-other.c
> +++ b/drivers/platform/x86/lenovo/wmi-other.c
> @@ -166,7 +166,7 @@ MODULE_PARM_DESC(relax_fan_constraint,
> */
> static int lwmi_om_fan_get_set(struct lwmi_om_priv *priv, int channel, u32 *val, bool set)
> {
> - struct wmi_method_args_32 args;
> + struct wmi_method_args_32 args = { 0x0, 0x0 };

`= {}' is enough and more readable. Ditto for following ones and those
in other patches.

Also, sashiko.dev reported that lwmi_gz_profile_set() needs zero-
initialization too. Could you fix it in this patch too?

https://sashiko.dev/#/patchset/20260331181208.421552-1-derekjohn.clark%40gmail.com

With them fixed:

Reviewed-by: Rong Zhang <i@xxxxxxxx>
Tested-by: Rong Zhang <i@xxxxxxxx>

Thanks,
Rong

> u32 method_id, retval;
> int err;
>
> @@ -772,7 +772,7 @@ static ssize_t attr_current_value_store(struct kobject *kobj,
> struct tunable_attr_01 *tunable_attr)
> {
> struct lwmi_om_priv *priv = dev_get_drvdata(tunable_attr->dev);
> - struct wmi_method_args_32 args;
> + struct wmi_method_args_32 args = { 0x0, 0x0 };
> struct capdata01 capdata;
> enum thermal_mode mode;
> u32 attribute_id;
> @@ -835,7 +835,7 @@ static ssize_t attr_current_value_show(struct kobject *kobj,
> struct tunable_attr_01 *tunable_attr)
> {
> struct lwmi_om_priv *priv = dev_get_drvdata(tunable_attr->dev);
> - struct wmi_method_args_32 args;
> + struct wmi_method_args_32 args = { 0x0, 0x0 };
> enum thermal_mode mode;
> u32 attribute_id;
> int retval;