drivers/platform/x86/dell/dell_rbu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
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
On Fri, 03 Apr 2026 16:42:39 +0300, Fedor Pchelkin wrote:
> 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.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
commit: f8fd138c2363c0e2d3235c32bfb4fb5c6474e4ae
--
i.
© 2016 - 2026 Red Hat, Inc.