[PATCH] drm/imagination: Correctly check strscpy() in pvr_gpuid_decode_string()

Matt Coster posted 1 patch 18 hours ago
drivers/gpu/drm/imagination/pvr_device.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] drm/imagination: Correctly check strscpy() in pvr_gpuid_decode_string()
Posted by Matt Coster 18 hours ago
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@linaro.org>
Closes: https://lore.kernel.org/r/aYXvElClUKW_DY_I@stanley.mountain/
Signed-off-by: Matt Coster <matt.coster@imgtec.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