[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260206-gpuid-strlen-fix-v1-1-238144ce306e@imgtec.com>
Date: Fri, 6 Feb 2026 15:22:25 +0000
From: Matt Coster <matt.coster@...tec.com>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard
<mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>
CC: Alexandru Dadu <alexandru.dadu@...tec.com>,
Frank Binns
<frank.binns@...tec.com>,
Brajesh Gupta <brajesh.gupta@...tec.com>,
"Alessio
Belle" <alessio.belle@...tec.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
"Matt
Coster" <matt.coster@...tec.com>
Subject: [PATCH] drm/imagination: Correctly check strscpy() in
pvr_gpuid_decode_string()
The constant PVR_GPUID_STRING_MIN_LENGTH was defined with a U suffix,
causing the return value of strscpy() to be promoted to unsigned before
it could be checked for a negative errno.
Fix this by stripping the U suffix from PVR_GPUID_STRING_MIN_LENGTH (and
PVR_GPUID_STRING_MAX_LENGTH for consistency).
Fixes: 3bf74137340a ("drm/imagination: Add gpuid module parameter")
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/aYXvElClUKW_DY_I@stanley.mountain/
Signed-off-by: Matt Coster <matt.coster@...tec.com>
---
drivers/gpu/drm/imagination/pvr_device.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/imagination/pvr_device.h
index cfda215e7428..d742d7c1ec93 100644
--- a/drivers/gpu/drm/imagination/pvr_device.h
+++ b/drivers/gpu/drm/imagination/pvr_device.h
@@ -39,8 +39,8 @@ struct firmware;
/* Forward declaration from <linux/pwrseq/consumer.h> */
struct pwrseq_desc;
-#define PVR_GPUID_STRING_MIN_LENGTH 7U
-#define PVR_GPUID_STRING_MAX_LENGTH 32U
+#define PVR_GPUID_STRING_MIN_LENGTH 7
+#define PVR_GPUID_STRING_MAX_LENGTH 32
/**
* struct pvr_gpu_id - Hardware GPU ID information for a PowerVR device
---
base-commit: 69674c1c704c0199ca7a3947f3cdcd575973175d
change-id: 20260206-gpuid-strlen-fix-5622c1fdd0b2
Powered by blists - more mailing lists