[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMEXYWf_m8PL-ZGAv_1ufLp_1ryQK15ziaO90_OxmMV4VkpTPQ@mail.gmail.com>
Date: Tue, 23 Dec 2025 19:24:14 +0000
From: Benjamin Philip <benjamin.philip495@...il.com>
To: platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Mark Pearson <mpearson-lenovo@...ebb.ca>, "Derek J. Clark" <derekjohn.clark@...il.com>,
Hans de Goede <hansg@...nel.org>, Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Benjamin Philip <benjamin.philip495@...il.com>
Subject: [PATCH 4/5] platform/x86: think-lmi: fix column limit overflow
This commit handles some column limit overflows (that occur after fixing
their alignment), i.e. the following check:
CHECK: line length of ... exceeds 100 columns
by defining a constant opt, and replacing the offending
expression with opt.
Signed-off-by: Benjamin Philip <benjamin.philip495@...il.com>
---
drivers/platform/x86/lenovo/think-lmi.c | 31 +++++++++++++++----------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/x86/lenovo/think-lmi.c
b/drivers/platform/x86/lenovo/think-lmi.c
index 1ada4d800383..07ba0d84720a 100644
--- a/drivers/platform/x86/lenovo/think-lmi.c
+++ b/drivers/platform/x86/lenovo/think-lmi.c
@@ -1083,12 +1083,13 @@ static ssize_t type_show(struct kobject *kobj,
struct kobj_attribute *attr,
}
static ssize_t current_value_store(struct kobject *kobj,
- struct kobj_attribute *attr,
- const char *buf, size_t count)
+ struct kobj_attribute *attr, const char *buf,
+ size_t count)
{
struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
char *set_str = NULL, *new_setting = NULL;
char *auth_str = NULL;
+ const char *opt;
int ret;
if (!tlmi_priv.can_set_bios_settings)
@@ -1163,10 +1164,11 @@ static ssize_t current_value_store(struct kobject *kobj,
ret = tlmi_save_bios_settings("");
} else { /* old non-opcode based authentication method (deprecated) */
if (tlmi_priv.pwd_admin->pwd_enabled && tlmi_priv.pwd_admin->password[0]) {
+ opt = encoding_options[tlmi_priv.pwd_admin->encoding];
auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
- tlmi_priv.pwd_admin->password,
- encoding_options[tlmi_priv.pwd_admin->encoding],
- tlmi_priv.pwd_admin->kbdlang);
+ tlmi_priv.pwd_admin->password,
+ opt,
+ tlmi_priv.pwd_admin->kbdlang);
if (!auth_str) {
ret = -ENOMEM;
goto out;
@@ -1299,6 +1301,7 @@ static ssize_t save_settings_store(struct
kobject *kobj, struct kobj_attribute *
const char *buf, size_t count)
{
char *auth_str = NULL;
+ const char *opt;
int ret = 0;
int cmd;
@@ -1347,9 +1350,10 @@ static ssize_t save_settings_store(struct
kobject *kobj, struct kobj_attribute *
ret = tlmi_save_bios_settings("");
} else { /* old non-opcode based authentication method (deprecated) */
if (tlmi_priv.pwd_admin->pwd_enabled && tlmi_priv.pwd_admin->password[0]) {
+ opt = encoding_options[tlmi_priv.pwd_admin->encoding];
auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
tlmi_priv.pwd_admin->password,
- encoding_options[tlmi_priv.pwd_admin->encoding],
+ opt,
tlmi_priv.pwd_admin->kbdlang);
if (!auth_str) {
ret = -ENOMEM;
@@ -1381,11 +1385,13 @@ static ssize_t save_settings_store(struct
kobject *kobj, struct kobj_attribute *
static struct kobj_attribute save_settings = __ATTR_RW(save_settings);
/* ---- Debug interface---------------------------------------------------------
*/
-static ssize_t debug_cmd_store(struct kobject *kobj, struct
kobj_attribute *attr,
- const char *buf, size_t count)
+static ssize_t debug_cmd_store(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf,
+ size_t count)
{
char *set_str = NULL, *new_setting = NULL;
char *auth_str = NULL;
+ const char *opt;
int ret;
if (!tlmi_priv.can_debug_cmd)
@@ -1397,10 +1403,11 @@ static ssize_t debug_cmd_store(struct kobject
*kobj, struct kobj_attribute *attr
return -ENOMEM;
if (tlmi_priv.pwd_admin->pwd_enabled && tlmi_priv.pwd_admin->password[0]) {
+ opt = encoding_options[tlmi_priv.pwd_admin->encoding];
auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
- tlmi_priv.pwd_admin->password,
- encoding_options[tlmi_priv.pwd_admin->encoding],
- tlmi_priv.pwd_admin->kbdlang);
+ tlmi_priv.pwd_admin->password,
+ opt,
+ tlmi_priv.pwd_admin->kbdlang);
if (!auth_str) {
ret = -ENOMEM;
goto out;
@@ -1775,7 +1782,7 @@ static int tlmi_analyze(struct wmi_device *wdev)
ffs(tlmi_priv.pwdcfg.ext.hdd_user_password) - 1;
}
if (tlmi_priv.pwdcfg.ext.nvme_user_password ||
- tlmi_priv.pwdcfg.ext.nvme_master_password) {
+ tlmi_priv.pwdcfg.ext.nvme_master_password) {
tlmi_priv.pwd_nvme->pwd_enabled = true;
if (tlmi_priv.pwdcfg.ext.nvme_master_password)
tlmi_priv.pwd_nvme->index =
--
2.52.0
Powered by blists - more mailing lists