linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
@ 2019-12-17 19:06 Hans de Goede
  2019-12-18 10:17 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2019-12-17 19:06 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko
  Cc: Hans de Goede, platform-driver-x86, linux-kernel, stable

At least on the HP Envy x360 15-cp0xxx model the WMI interface
for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes,
otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS):

Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5

We do not care about the contents of the buffer, we just want to know
if the HPWMI_FEATURE2_QUERY command is supported.

This commits bumps the buffer size, fixing the error.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/hp-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 9579a706fc08..a881b709af25 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -300,7 +300,7 @@ static int __init hp_wmi_bios_2008_later(void)
 
 static int __init hp_wmi_bios_2009_later(void)
 {
-	int state = 0;
+	u8 state[128];
 	int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, HPWMI_READ, &state,
 				       sizeof(state), sizeof(state));
 	if (!ret)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
  2019-12-17 19:06 [PATCH] platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes Hans de Goede
@ 2019-12-18 10:17 ` Andy Shevchenko
  2019-12-18 11:18   ` Hans de Goede
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2019-12-18 10:17 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stable

On Tue, Dec 17, 2019 at 9:06 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> At least on the HP Envy x360 15-cp0xxx model the WMI interface
> for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes,
> otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS):
>
> Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5
>
> We do not care about the contents of the buffer, we just want to know
> if the HPWMI_FEATURE2_QUERY command is supported.
>
> This commits bumps the buffer size, fixing the error.
>

Fixes tag?

> Cc: stable@vger.kernel.org
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/hp-wmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 9579a706fc08..a881b709af25 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -300,7 +300,7 @@ static int __init hp_wmi_bios_2008_later(void)
>
>  static int __init hp_wmi_bios_2009_later(void)
>  {
> -       int state = 0;
> +       u8 state[128];
>         int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, HPWMI_READ, &state,
>                                        sizeof(state), sizeof(state));
>         if (!ret)
> --
> 2.23.0
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
  2019-12-18 10:17 ` Andy Shevchenko
@ 2019-12-18 11:18   ` Hans de Goede
  2019-12-18 15:08     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2019-12-18 11:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stable

Hi,

On 18-12-2019 11:17, Andy Shevchenko wrote:
> On Tue, Dec 17, 2019 at 9:06 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> At least on the HP Envy x360 15-cp0xxx model the WMI interface
>> for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes,
>> otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS):
>>
>> Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5
>>
>> We do not care about the contents of the buffer, we just want to know
>> if the HPWMI_FEATURE2_QUERY command is supported.
>>
>> This commits bumps the buffer size, fixing the error.
>>
> 
> Fixes tag?

The HPWMI_FEATURE2_QUERY call was introduced in 8a1513b4932, so I guess
this should have a:

Fixes: 8a1513b4932 ("hp-wmi: limit hotkey enable")

Tag, shall I send a v2 with this, or can you add it while applying the patch?

Regards,

Hans




> 
>> Cc: stable@vger.kernel.org
>> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/platform/x86/hp-wmi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
>> index 9579a706fc08..a881b709af25 100644
>> --- a/drivers/platform/x86/hp-wmi.c
>> +++ b/drivers/platform/x86/hp-wmi.c
>> @@ -300,7 +300,7 @@ static int __init hp_wmi_bios_2008_later(void)
>>
>>   static int __init hp_wmi_bios_2009_later(void)
>>   {
>> -       int state = 0;
>> +       u8 state[128];
>>          int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, HPWMI_READ, &state,
>>                                         sizeof(state), sizeof(state));
>>          if (!ret)
>> --
>> 2.23.0
>>
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
  2019-12-18 11:18   ` Hans de Goede
@ 2019-12-18 15:08     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2019-12-18 15:08 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stable

On Wed, Dec 18, 2019 at 1:18 PM Hans de Goede <hdegoede@redhat.com> wrote:
> On 18-12-2019 11:17, Andy Shevchenko wrote:
> > On Tue, Dec 17, 2019 at 9:06 PM Hans de Goede <hdegoede@redhat.com> wrote:

> > Fixes tag?
>
> The HPWMI_FEATURE2_QUERY call was introduced in 8a1513b4932, so I guess
> this should have a:
>
> Fixes: 8a1513b4932 ("hp-wmi: limit hotkey enable")
>
> Tag, shall I send a v2 with this, or can you add it while applying the patch?

I added it.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-18 15:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 19:06 [PATCH] platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes Hans de Goede
2019-12-18 10:17 ` Andy Shevchenko
2019-12-18 11:18   ` Hans de Goede
2019-12-18 15:08     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).