aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinson Lee <vlee@vmware.com>2011-11-10 14:55:40 -0500
committerDave Airlie <airlied@redhat.com>2011-11-11 05:59:15 -0500
commit471dd2ef3761de01348b19e83128a778df1d45b2 (patch)
tree6fbe78c023f3c6a7ef9e49f2478be4983ed4db20
parentbaa91d640034dd8d0b58a9088f5fefe5cec3c8c4 (diff)
drm: Ensure string is null terminated.
Fixes Coverity buffer not null terminated defect. Signed-off-by: Vinson Lee <vlee@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 9a2e2a14b3bb..405c63b9d539 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2118,8 +2118,10 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
2118 property->num_values = num_values; 2118 property->num_values = num_values;
2119 INIT_LIST_HEAD(&property->enum_blob_list); 2119 INIT_LIST_HEAD(&property->enum_blob_list);
2120 2120
2121 if (name) 2121 if (name) {
2122 strncpy(property->name, name, DRM_PROP_NAME_LEN); 2122 strncpy(property->name, name, DRM_PROP_NAME_LEN);
2123 property->name[DRM_PROP_NAME_LEN-1] = '\0';
2124 }
2123 2125
2124 list_add_tail(&property->head, &dev->mode_config.property_list); 2126 list_add_tail(&property->head, &dev->mode_config.property_list);
2125 return property; 2127 return property;