mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
@ 2026-04-03 13:42 Fedor Pchelkin
  2026-04-09 13:41 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Fedor Pchelkin @ 2026-04-03 13:42 UTC (permalink / raw)
  To: Stuart Hayes, Ilpo Järvinen
  Cc: Fedor Pchelkin, Hans de Goede, Andrew Morton, Abhay Salunke,
	platform-driver-x86, linux-kernel, lvc-project

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
  2026-04-03 13:42 [PATCH] platform/x86: dell_rbu: avoid uninit value usage in packet_size_write() Fedor Pchelkin
@ 2026-04-09 13:41 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2026-04-09 13:41 UTC (permalink / raw)
  To: Stuart Hayes, Fedor Pchelkin
  Cc: Hans de Goede, Andrew Morton, Abhay Salunke, platform-driver-x86,
	linux-kernel, lvc-project

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-09 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-03 13:42 [PATCH] platform/x86: dell_rbu: avoid uninit value usage in packet_size_write() Fedor Pchelkin
2026-04-09 13:41 ` Ilpo Järvinen

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®