summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/video-i2c.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-10 15:19:14 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-11 20:32:17 +0300
commitc0decac19da3906d9b66291e57b7759489e1170f (patch)
tree0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/i2c/video-i2c.c
parentb730c40813a95ebc35757790a990794f55e2b61c (diff)
downloadlinux-c0decac19da3906d9b66291e57b7759489e1170f.tar.xz
media: use strscpy() instead of strlcpy()
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/video-i2c.c')
-rw-r--r--drivers/media/i2c/video-i2c.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index 06d29d8f6be8..4d49af86c15e 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -352,8 +352,8 @@ static int video_i2c_querycap(struct file *file, void *priv,
struct video_i2c_data *data = video_drvdata(file);
struct i2c_client *client = data->client;
- strlcpy(vcap->driver, data->v4l2_dev.name, sizeof(vcap->driver));
- strlcpy(vcap->card, data->vdev.name, sizeof(vcap->card));
+ strscpy(vcap->driver, data->v4l2_dev.name, sizeof(vcap->driver));
+ strscpy(vcap->card, data->vdev.name, sizeof(vcap->card));
sprintf(vcap->bus_info, "I2C:%d-%d", client->adapter->nr, client->addr);
@@ -378,7 +378,7 @@ static int video_i2c_enum_input(struct file *file, void *fh,
if (vin->index > 0)
return -EINVAL;
- strlcpy(vin->name, "Camera", sizeof(vin->name));
+ strscpy(vin->name, "Camera", sizeof(vin->name));
vin->type = V4L2_INPUT_TYPE_CAMERA;
@@ -534,7 +534,7 @@ static int video_i2c_probe(struct i2c_client *client,
data->client = client;
v4l2_dev = &data->v4l2_dev;
- strlcpy(v4l2_dev->name, VIDEO_I2C_DRIVER, sizeof(v4l2_dev->name));
+ strscpy(v4l2_dev->name, VIDEO_I2C_DRIVER, sizeof(v4l2_dev->name));
ret = v4l2_device_register(&client->dev, v4l2_dev);
if (ret < 0)