diff options
-rw-r--r-- | drivers/media/media-device.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 99b80b6f7f67..1957c0df08fd 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c | |||
@@ -102,9 +102,12 @@ static long media_device_enum_entities(struct media_device *mdev, | |||
102 | return -EINVAL; | 102 | return -EINVAL; |
103 | 103 | ||
104 | u_ent.id = ent->id; | 104 | u_ent.id = ent->id; |
105 | u_ent.name[0] = '\0'; | 105 | if (ent->name) { |
106 | if (ent->name) | 106 | strncpy(u_ent.name, ent->name, sizeof(u_ent.name)); |
107 | strlcpy(u_ent.name, ent->name, sizeof(u_ent.name)); | 107 | u_ent.name[sizeof(u_ent.name) - 1] = '\0'; |
108 | } else { | ||
109 | memset(u_ent.name, 0, sizeof(u_ent.name)); | ||
110 | } | ||
108 | u_ent.type = ent->type; | 111 | u_ent.type = ent->type; |
109 | u_ent.revision = ent->revision; | 112 | u_ent.revision = ent->revision; |
110 | u_ent.flags = ent->flags; | 113 | u_ent.flags = ent->flags; |