Skip to contentSkip to conversation

drm: Use strscpy() instead of strscpy_pad()

PATCH RESEND In review Thorsten Blum 1 participant 2 messages Sep 8, 2025 – Sep 25, 2025

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

PATCH RESEND 1/1 drm: Use strscpy() instead of strscpy_pad()

kzalloc() already zero-initializes the destination buffers, making strscpy() sufficient for safely copying the names. The additional NUL-padding performed by strscpy_pad() is unnecessary.

If the destination buffer has a fixed length, strscpy() automatically determines its size using sizeof() when the argument is omitted. This makes the explicit size arguments unnecessary.

No functional changes intended.

---
 drivers/gpu/drm/drm_property.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_property.c +2 -2
index 596272149a35..47f2891f3f06 100644
@@ -128,7 +128,7 @@ struct drm_property *drm_property_create(struct drm_device *dev,
 	property->num_values = num_values;
 	INIT_LIST_HEAD(&property->enum_list);
 
-	strscpy_pad(property->name, name, DRM_PROP_NAME_LEN);
+	strscpy(property->name, name);
 
 	list_add_tail(&property->head, &dev->mode_config.property_list);
 
@@ -421,7 +421,7 @@ int drm_property_add_enum(struct drm_property *property,
 	if (!prop_enum)
 		return -ENOMEM;
 
-	strscpy_pad(prop_enum->name, name, DRM_PROP_NAME_LEN);
+	strscpy(prop_enum->name, name);
 	prop_enum->value = value;
 
 	property->values[index] = value;
Signature · 1 line
2.51.0
#1 lore raw

Hi all,

Quoted 6 lines · Thorsten Blum

kzalloc() already zero-initializes the destination buffers, making strscpy() sufficient for safely copying the names. The additional NUL-padding performed by strscpy_pad() is unnecessary.

Quoted 8 lines

If the destination buffer has a fixed length, strscpy() automatically determines its size using sizeof() when the argument is omitted. This makes the explicit size arguments unnecessary.

No functional changes intended.

---

I've been resending this patch since April and I'm wondering what else I could do to get this reviewed and/or merged?

The patch still applies to both linux-next and master.

Thanks,
Thorsten