Re: [PATCH 1/2] platform/x86: think-lmi: Fix check for admin password being set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 6/9/21 5:17 PM, Hans de Goede wrote:
> 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 <markpearson@xxxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
> Addresses-Coverity-ID: 1505158 ("NO_EFFECT")
> Fixes: a7314b3b1d8a ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>

I've added this series to my review-hans branch (soon to be pdx86/for-next) branch now.

Regards,

Hans



> ---
>  drivers/platform/x86/think-lmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index c6413b906e4a..4881de4e669d 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -537,7 +537,7 @@ static ssize_t current_value_store(struct kobject *kobj,
>  	p = strchrnul(new_setting, '\n');
>  	*p = '\0';
>  
> -	if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password) {
> +	if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
>  		auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
>  				tlmi_priv.pwd_admin->password,
>  				encoding_options[tlmi_priv.pwd_admin->encoding],
> @@ -563,7 +563,7 @@ static ssize_t current_value_store(struct kobject *kobj,
>  	if (ret)
>  		goto out;
>  
> -	if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password)
> +	if (auth_str)
>  		ret = tlmi_save_bios_settings(auth_str);
>  	else
>  		ret = tlmi_save_bios_settings("");
> 




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux