[bug report] platform/x86: think-lmi: Add WMI interface support on Lenovo platforms

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

 



Hello Mark Pearson,

The patch a7314b3b1d8a: "platform/x86: think-lmi: Add WMI interface
support on Lenovo platforms" from May 30, 2021, leads to the
following static checker warning:

drivers/platform/x86/think-lmi.c:540 current_value_store() warn: this array is probably non-NULL. 'tlmi_priv.pwd_admin->password'
drivers/platform/x86/think-lmi.c:566 current_value_store() warn: this array is probably non-NULL. 'tlmi_priv.pwd_admin->password'

drivers/platform/x86/think-lmi.c
   533          if (!new_setting)
   534                  return -ENOMEM;
   535  
   536          /* Strip out CR if one is present */
   537          p = strchrnul(new_setting, '\n');
   538          *p = '\0';
   539  
   540          if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password) {
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This can't be NULL

   541                  auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
   542                                  tlmi_priv.pwd_admin->password,
   543                                  encoding_options[tlmi_priv.pwd_admin->encoding],
   544                                  tlmi_priv.pwd_admin->kbdlang);
   545                  if (!auth_str) {
   546                          ret = -ENOMEM;
   547                          goto out;
   548                  }
   549          }
   550  
   551          if (auth_str)
   552                  set_str = kasprintf(GFP_KERNEL, "%s,%s,%s", setting->display_name,
   553                                  new_setting, auth_str);
   554          else
   555                  set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name,
   556                                  new_setting);
   557          if (!set_str) {
   558                  ret = -ENOMEM;
   559                  goto out;
   560          }
   561  
   562          ret = tlmi_simple_call(LENOVO_SET_BIOS_SETTINGS_GUID, set_str);
   563          if (ret)
   564                  goto out;
   565  
   566          if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Same

   567                  ret = tlmi_save_bios_settings(auth_str);
   568          else
   569                  ret = tlmi_save_bios_settings("");
   570  
   571  out:
   572          kfree(auth_str);
   573          kfree(set_str);

regards,
dan carpenter



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

  Powered by Linux