Re: [PATCH] Revert "platform/x86: hp-wmi: Changing bios_args.data to be dynamically allocated"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

I will ask to remove review request title is  "[PATCH] Revert "platform/x86:
hp-wmi: Changing bios_args.data to be dynamically allocated"

I am testing a cleaner solution to submit instead of  reverting the
changes to hp_wmi_perform_query method.  The changes were made and
tested on business notebooks without any issues.  I will submit a new
patch as soon as I get the test results from a  community member who
owns an Omen 15 system.

The proposed patch which I am pending test results, it is as follows

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 0e9a25b56e0e..7bcfa07cc6ab 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -292,12 +292,14 @@ static int hp_wmi_perform_query(int query, enum
hp_wmi_command command,
  struct bios_args *args = NULL;
  int mid, actual_outsize, ret;
  size_t bios_args_size;
+ int actual_insize;

  mid = encode_outsize_for_pvsz(outsize);
  if (WARN_ON(mid < 0))
  return mid;

- bios_args_size = struct_size(args, data, insize);
+ actual_insize = max(insize, 128);
+ bios_args_size = struct_size(args, data, actual_insize);
  args = kmalloc(bios_args_size, GFP_KERNEL);
  if (!args)
  return -ENOMEM;
-----

I received confirmation from another community member and confirmed
the patch resolves HPWMI_FAN GET/SET calls in an OMEN Laptop
15-ek0xxx.   No problems were reported when testing on several Elite
and Zbooks.

Regards,

Jorge

On Tue, Jun 7, 2022 at 4:55 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Tue, Jun 7, 2022 at 7:59 AM Jorge Lopez <jorgealtxwork@xxxxxxxxx> wrote:
> >
> > This reverts commit 4b4967cbd2685f313411e6facf915fb2ae01d796.
> >
> > Changes to bios_args.data to be allocated dynamically causes
> > several WMI calls for OMEN laptops to fail.  The problem
> > is resolved by reverting commit 4b4967cbd26.
>
> As a quick fix it's good, but have you had a chance to understand why
> this failure happened in the first place?
>
> Can you check my theory that is expressed in the code below?
>
> ...
>
> > -       bios_args_size = struct_size(args, data, insize);
>
> Try to replace insize here with
>
> max(insize, 128)
>
> > -       args = kmalloc(bios_args_size, GFP_KERNEL);
> > -       if (!args)
> > -               return -ENOMEM;
> > -
> > -       input.length = bios_args_size;
> > -       input.pointer = args;
>
> --
> With Best Regards,
> Andy Shevchenko



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux