diff options
| author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-07-17 07:52:08 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 19:27:08 -0400 |
| commit | de8eae36057b50086278af1ec4d96fc9a2e35f0b (patch) | |
| tree | a8bb6d6297606bdaa5b2f3e68e26ef88468d11d9 | |
| parent | 62ea864f84fed6e04dd033d500d4c9183a83d590 (diff) | |
[media] media: Use strlcpy instead of custom code
Replace strncpy + manually setting the terminating '\0' with an strlcpy
call.
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
| -rw-r--r-- | drivers/media/media-device.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 73a432934bd8..7b39440192d6 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c | |||
| @@ -103,10 +103,8 @@ static long media_device_enum_entities(struct media_device *mdev, | |||
| 103 | return -EINVAL; | 103 | return -EINVAL; |
| 104 | 104 | ||
| 105 | u_ent.id = ent->id; | 105 | u_ent.id = ent->id; |
| 106 | if (ent->name) { | 106 | if (ent->name) |
| 107 | strncpy(u_ent.name, ent->name, sizeof(u_ent.name)); | 107 | strlcpy(u_ent.name, ent->name, sizeof(u_ent.name)); |
| 108 | u_ent.name[sizeof(u_ent.name) - 1] = '\0'; | ||
| 109 | } | ||
| 110 | u_ent.type = ent->type; | 108 | u_ent.type = ent->type; |
| 111 | u_ent.revision = ent->revision; | 109 | u_ent.revision = ent->revision; |
| 112 | u_ent.flags = ent->flags; | 110 | u_ent.flags = ent->flags; |
