X86 platform drivers
 help / color / mirror / Atom feed
From: yahia <yahia.a.abdrabou@gmail.com>
To: ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
	yahia ahmed <yahia.a.abdrabou@gmail.com>,
	sashiko-bot@kernel.org
Subject: [PATCH 3/3] hp-wmi: move from kmalloc to kzalloc
Date: Sun, 12 Jul 2026 22:11:30 +0300	[thread overview]
Message-ID: <20260712191130.41183-4-yahia.a.abdrabou@gmail.com> (raw)
In-Reply-To: <20260712191130.41183-1-yahia.a.abdrabou@gmail.com>

From: yahia ahmed <yahia.a.abdrabou@gmail.com>

hp_wmi_query_perform() currently uses kmalloc to allocate memory for the
bios's response, though this creates a security hole pointed out by
sashiko that when using kmalloc, it won't zero out the memory space, thus
leaving information like passwords and other important data.

Reported-by: sashiko-bot@kernel.org
Link: https://sashiko.dev/#/message/20260706143855.35002-1-yahia.a.abdrabou%40gmail.com
Fixes: 4b4967cbd268 ("platform/x86: hp-wmi: Changing bios_args.data to be dynamically allocated")
Signed-off-by: yahia ahmed <yahia.a.abdrabou@gmail.com>
---
 drivers/platform/x86/hp/hp-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 3235ade2fa98..f120900f536d 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -593,7 +593,7 @@ static int hp_wmi_perform_query(int query, enum hp_wmi_command command,
 
 	actual_insize = max(insize, 128);
 	bios_args_size = struct_size(args, data, actual_insize);
-	args = kmalloc(bios_args_size, GFP_KERNEL);
+	args = kzalloc(bios_args_size, GFP_KERNEL);
 	if (!args)
 		return -ENOMEM;
 
-- 
2.55.0


  parent reply	other threads:[~2026-07-12 19:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-12 19:11 [PATCH 0/3]: hp-wmi: fix various issues with yahia
2026-07-12 19:11 ` [PATCH 1/3] hp-wmi: refactor to use __free yahia
2026-07-13 11:21   ` Ilpo Järvinen
2026-07-12 19:11 ` [PATCH 2/3] hp-wmi: fix potential integer underflow yahia
2026-07-13 11:23   ` Ilpo Järvinen
2026-07-13 12:24     ` yahia
2026-07-12 19:11 ` yahia [this message]
2026-07-13 11:30   ` [PATCH 3/3] hp-wmi: move from kmalloc to kzalloc 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=20260712191130.41183-4-yahia.a.abdrabou@gmail.com \
    --to=yahia.a.abdrabou@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sashiko-bot@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox