From: Fedor Pchelkin <pchelkin@ispras.ru>
To: "Stuart Hayes" <stuart.w.hayes@gmail.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Fedor Pchelkin <pchelkin@ispras.ru>,
Hans de Goede <hansg@kernel.org>, Andrew Morton <akpm@osdl.org>,
Abhay Salunke <Abhay_Salunke@dell.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH] platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
Date: Fri, 3 Apr 2026 16:42:39 +0300 [thread overview]
Message-ID: <20260403134240.604837-1-pchelkin@ispras.ru> (raw)
Ensure the temp value has been properly parsed from the user-provided
buffer and initialized to be used in later operations. While at it,
prefer a convenient kstrtoul() helper.
Found by Linux Verification Center (linuxtesting.org) with Svace static
analysis tool.
Fixes: ad6ce87e5bd4 ("[PATCH] dell_rbu: changes in packet update mechanism")
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
drivers/platform/x86/dell/dell_rbu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index eb50f1d75d0c..225c318d4b44 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -619,9 +619,12 @@ static ssize_t packet_size_write(struct file *filp, struct kobject *kobj,
char *buffer, loff_t pos, size_t count)
{
unsigned long temp;
+
+ if (kstrtoul(buffer, 10, &temp))
+ return -EINVAL;
+
spin_lock(&rbu_data.lock);
packet_empty_list();
- sscanf(buffer, "%lu", &temp);
if (temp < 0xffffffff)
rbu_data.packetsize = temp;
--
2.53.0
next reply other threads:[~2026-04-03 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 13:42 Fedor Pchelkin [this message]
2026-04-09 13:41 ` Ilpo Järvinen
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=20260403134240.604837-1-pchelkin@ispras.ru \
--to=pchelkin@ispras.ru \
--cc=Abhay_Salunke@dell.com \
--cc=akpm@osdl.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stuart.w.hayes@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®