Skip to content

Commit 86bb2e3

Browse files
committed
platform/x86: think-lmi: Fix check for admin password being set
tlmi_priv.pwd_admin->password is an array (not a pointer), so the correct way to check for the password being set is to check for tlmi_priv.pwd_admin->password[0] != 0. For the second check, replace the check with checking that auth_str is set instead. Cc: Mark Pearson <[email protected]> Reported-by: Dan Carpenter <[email protected]> Reported-by: coverity-bot <[email protected]> Addresses-Coverity-ID: 1505158 ("NO_EFFECT") Fixes: a7314b3 ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cb58c27 commit 86bb2e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/x86/think-lmi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static ssize_t current_value_store(struct kobject *kobj,
537537
p = strchrnul(new_setting, '\n');
538538
*p = '\0';
539539

540-
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password) {
540+
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
541541
auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
542542
tlmi_priv.pwd_admin->password,
543543
encoding_options[tlmi_priv.pwd_admin->encoding],
@@ -563,7 +563,7 @@ static ssize_t current_value_store(struct kobject *kobj,
563563
if (ret)
564564
goto out;
565565

566-
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password)
566+
if (auth_str)
567567
ret = tlmi_save_bios_settings(auth_str);
568568
else
569569
ret = tlmi_save_bios_settings("");

0 commit comments

Comments
 (0)