From: Vinson Lee Date: Thu, 10 Nov 2011 19:55:40 +0000 (-0800) Subject: drm: Ensure string is null terminated. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=471dd2ef3761de01348b19e83128a778df1d45b2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm: Ensure string is null terminated. Fixes Coverity buffer not null terminated defect. Signed-off-by: Vinson Lee Signed-off-by: Dave Airlie --- 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, property->num_values = num_values; INIT_LIST_HEAD(&property->enum_blob_list); - if (name) + if (name) { strncpy(property->name, name, DRM_PROP_NAME_LEN); + property->name[DRM_PROP_NAME_LEN-1] = '\0'; + } list_add_tail(&property->head, &dev->mode_config.property_list); return property;