Skip to contentSkip to conversation

Coverity: current_value_store(): NO_EFFECT

DISCUSSION coverity-bot 1 participant 1 message Jun 8, 2021 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hello!

This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20210608 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:

Thu Jun 3 12:56:40 2021 +0200
a7314b3b1d8a ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")

Coverity reported the following:

*** CID 1505158: (NO_EFFECT)
/drivers/platform/x86/think-lmi.c: 566 in current_value_store()
560 }
561

562     	ret = tlmi_simple_call(LENOVO_SET_BIOS_SETTINGS_GUID, set_str);
563     	if (ret)
564     		goto out;
565
vvv     CID 1505158:    (NO_EFFECT)
vvv     Comparing an array to null is not useful: "tlmi_priv.pwd_admin->password", since the test will always evaluate as true.
566     	if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password)
567     		ret = tlmi_save_bios_settings(auth_str);
568     	else
569     		ret = tlmi_save_bios_settings("");

570
571 out:
/drivers/platform/x86/think-lmi.c: 540 in current_value_store()
534 return -ENOMEM;
535

536     	/* Strip out CR if one is present */
537     	p = strchrnul(new_setting, '\n');
538     	*p = '\0';
539
vvv     CID 1505158:    (NO_EFFECT)
vvv     Comparing an array to null is not useful: "tlmi_priv.pwd_admin->password", since the test will always evaluate as true.
540     	if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password) {
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) {

If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):

Addresses-Coverity-ID: 1505158 ("NO_EFFECT")

Fixes a7314b3b1d8a ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")

Thanks for your attention!

Signature · 1 line
Coverity-bot