Skip to contentSkip to conversation

platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes

PATCH In review Hans de Goede 2 participants 4 messages Dec 17, 2019 – Dec 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes

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.

---
 drivers/platform/x86/hp-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +1 -1
index 9579a706fc08..a881b709af25 100644
@@ -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)
Signature · 1 line
2.23.0
#1 lore raw
Quoted 5 lines · Hans de Goede

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):

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

Quoted 23 lines
---
 drivers/platform/x86/hp-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +1 -2
index 9579a706fc08..a881b709af25 100644
@@ -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

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hi,

Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Hans de Goede

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
Quoted 7 lines
Quoted 5 lines

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

Quoted 26 lines
Quoted 24 lines
---
  drivers/platform/x86/hp-wmi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +1 -2
index 9579a706fc08..a881b709af25 100644
@@ -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

#3 lore raw
Quoted 11 lines · Hans de Goede
Quoted 3 lines · Andy Shevchenko

On Tue, Dec 17, 2019 at 9:06 PM Hans de Goede <[email protected]> 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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko