From: Dan Carpenter <dan.carpenter@oracle.com>
To: markpearson@lenovo.com
Cc: platform-driver-x86@vger.kernel.org
Subject: [bug report] platform/x86: think-lmi: Add WMI interface support on Lenovo platforms
Date: Wed, 9 Jun 2021 13:18:23 +0300 [thread overview]
Message-ID: <YMCVb9IcJ5zNZCpj@mwanda> (raw)
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
next reply other threads:[~2021-06-09 10:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 10:18 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-06-09 10:43 [bug report] platform/x86: think-lmi: Add WMI interface support on Lenovo platforms Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YMCVb9IcJ5zNZCpj@mwanda \
--to=dan.carpenter@oracle.com \
--cc=markpearson@lenovo.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.