Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/hwmon: fix uninitialised access in xe_hwmon_pcode_write_power_limit
@ 2025-06-03 18:03 Qasim Ijaz
  2025-06-13 14:00 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
  0 siblings, 1 reply; 2+ messages in thread
From: Qasim Ijaz @ 2025-06-03 18:03 UTC (permalink / raw)
  To: lucas.demarchi, thomas.hellstrom, rodrigo.vivi, airlied, simona
  Cc: intel-xe, dri-devel, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=n, Size: 1659 bytes --]

val0/val1 are not initialised and are passed to xe_pcode_read():

    xe_hwmon_pcode_write_power_limit()
      └─▶ xe_pcode_read()
            └─▶ pcode_mailbox_rw()
                  └─▶ __pcode_mailbox_rw()

If __pcode_mailbox_rw fails, val0/val1 could be left
uninitialised leading to xe_hwmon_pcode_write_power_limit()
to access them via drm_dbg. Or an uninitialised val0/val1
could be dereferenced inside __pcode_mailbox_rw.

To fix zero-initialise them to avoid potential UB and 
propagate error on failure.

Fixes: 7596d839f622 ("drm/xe/hwmon: Add support to manage power limits though mailbox")
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
 drivers/gpu/drm/xe/xe_hwmon.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 0d32e977537c..04acb47488a0 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -179,7 +179,7 @@ static int xe_hwmon_pcode_write_power_limit(const struct xe_hwmon *hwmon, u32 at
 					    u32 uval)
 {
 	struct xe_tile *root_tile = xe_device_get_root_tile(hwmon->xe);
-	u32 val0, val1;
+	u32 val0 = 0, val1 = 0;
 	int ret = 0;
 
 	ret = xe_pcode_read(root_tile, PCODE_MBOX(PCODE_POWER_SETUP,
@@ -190,9 +190,11 @@ static int xe_hwmon_pcode_write_power_limit(const struct xe_hwmon *hwmon, u32 at
 						  READ_PL_FROM_PCODE : READ_PL_FROM_FW),
 						  &val0, &val1);
 
-	if (ret)
+	if (ret) {
 		drm_dbg(&hwmon->xe->drm, "read failed ch %d val0 0x%08x, val1 0x%08x, ret %d\n",
 			channel, val0, val1, ret);
+		return ret;
+	}
 
 	if (attr == PL1_HWMON_ATTR)
 		val0 = uval;
-- 
2.39.5


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

* ✗ LGCI.VerificationFailed: failure for drm/xe/hwmon: fix uninitialised access in xe_hwmon_pcode_write_power_limit
  2025-06-03 18:03 [PATCH] drm/xe/hwmon: fix uninitialised access in xe_hwmon_pcode_write_power_limit Qasim Ijaz
@ 2025-06-13 14:00 ` Patchwork
  0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2025-06-13 14:00 UTC (permalink / raw)
  To: Qasim Ijaz; +Cc: intel-xe

== Series Details ==

Series: drm/xe/hwmon: fix uninitialised access in xe_hwmon_pcode_write_power_limit
URL   : https://patchwork.freedesktop.org/series/150229/
State : failure

== Summary ==

Address 'qasdev00@gmail.com' is not on the allowlist, which prevents CI from being triggered for this patch.
If you want Intel GFX CI to accept this address, please contact the script maintainers at i915-ci-infra@lists.freedesktop.org.
Exception occurred during validation, bailing out!



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

end of thread, other threads:[~2025-06-13 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 18:03 [PATCH] drm/xe/hwmon: fix uninitialised access in xe_hwmon_pcode_write_power_limit Qasim Ijaz
2025-06-13 14:00 ` ✗ LGCI.VerificationFailed: failure for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox