Skip to contentSkip to conversation

drm/imagination: Correctly check strscpy() in pvr_gpuid_decode_string()

PATCH New Matt Coster 1 participant 1 message Feb 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/gpu/drm/imagination/pvr_device.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/imagination/pvr_device.h +2 -2
index cfda215e7428..d742d7c1ec93 100644
@@ -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