lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a02aa367-2ce8-ba6d-adc7-b91552566142@linux.intel.com>
Date: Tue, 4 Feb 2025 12:37:54 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Armin Wolf <W_Armin@....de>
cc: james@...iv.tech, markpearson@...ovo.com, jorge.lopez2@...com, 
    jdelvare@...e.com, linux@...ck-us.net, linux-hwmon@...r.kernel.org, 
    LKML <linux-kernel@...r.kernel.org>, Hans de Goede <hdegoede@...hat.com>, 
    platform-driver-x86@...r.kernel.org, corbet@....net, 
    linux-doc@...r.kernel.org
Subject: Re: [PATCH 4/7] platform/x86: hp-bioscfg: Use wmi_instance_count()

On Mon, 3 Feb 2025, Armin Wolf wrote:

> The WMI core already knows the instance count of a WMI guid.
> Use this information instead of querying all possible instances
> which is slow and might be unreliable.
> 
> Signed-off-by: Armin Wolf <W_Armin@....de>
> ---
>  drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> index 0b277b7e37dd..63c78b4d8258 100644
> --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> @@ -388,16 +388,13 @@ union acpi_object *hp_get_wmiobj_pointer(int instance_id, const char *guid_strin
>   */
>  int hp_get_instance_count(const char *guid_string)
>  {
> -	union acpi_object *wmi_obj = NULL;
> -	int i = 0;
> +	int ret;
> 
> -	do {
> -		kfree(wmi_obj);
> -		wmi_obj = hp_get_wmiobj_pointer(i, guid_string);
> -		i++;
> -	} while (wmi_obj);
> +	ret = wmi_instance_count(guid_string);
> +	if (ret < 0)
> +		return 0;
> 
> -	return i - 1;
> +	return ret;
>  }

Hi Armin,

While it is the existing way of doing things, I don't like how the error 
is not properly passed on here. And if the error handling is pushed 
upwards to the calling sites, then this entire function becomes useless 
and wmi_instance_count() could be used directly in the callers.

-- 
 i.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ