[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d976e978-6555-4adf-40fd-06870864a1aa@alu.unizg.hr>
Date: Mon, 3 Apr 2023 10:21:50 +0200
From: Mirsad Goran Todorovac <mirsad.todorovac@....unizg.hr>
To: Mark Pearson <mpearson-lenovo@...ebb.ca>
Cc: hdegoede@...hat.com, markgross@...nel.org, W_Armin@....de,
linux@...ssschuh.net, Mario.Limonciello@....com,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] platform/x86: think-lmi: Clean up display of
current_value on Thinkstation
On 3.4.2023. 3:31, Mark Pearson wrote:
> On ThinkStations on retrieving the attribute value the BIOS appends the
> possible values to the string.
> Clean up the display in the current_value_show function so the options
> part is not displayed.
>
> Fixes: a40cd7ef22fb ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
> Reported by Mario Limoncello <Mario.Limonciello@....com>
> Link: https://github.com/fwupd/fwupd/issues/5077#issuecomment-1488730526
> Signed-off-by: Mark Pearson <mpearson-lenovo@...ebb.ca>
> ---
> Changes in v2: For some reason v2 doesn't apply cleanly so rebased and
> started again. Hopefully this one works
>
> drivers/platform/x86/think-lmi.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 87f832142d8d..78dc82bda4dd 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -920,7 +920,7 @@ static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *at
> static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> {
> struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
> - char *item, *value;
> + char *item, *value, *p;
> int ret;
>
> ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID);
> @@ -931,9 +931,12 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
> value = strpbrk(item, ",");
> if (!value || value == item || !strlen(value + 1))
> ret = -EINVAL;
> - else
> + else {
> + /* On Workstations remove the Options part after the value */
> + p = strchrnul(value, ';');
> + *p = '\0';
> ret = sysfs_emit(buf, "%s\n", value + 1);
> -
> + }
> kfree(item);
>
> return ret;
I can confirm the build against the Torvalds 6.3-rc5 tree and Armin's patch
applied w these.
[root@...mtodorov kernel]# uname -rms
Linux 6.3.0-rc5-mt-20230401-00005-g10de4cefccf7 x86_64
[root@...mtodorov kernel]# cat /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]# echo scan > !$
echo scan > /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]# cat /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]# echo scan > /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]# cat /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]# echo scan > /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]# cat /sys/kernel/debug/kmemleak
[root@...mtodorov kernel]#
The leak is apparently gone in the original setup that reproduced the leak.
At your convenience, you can please add
Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@....unizg.hr>
Have a nice day.
Best regards,
Mirsad
--
Mirsad Todorovac
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb
Republic of Croatia, the European Union
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
Powered by blists - more mailing lists