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>
このコミットが含まれているのは:
@@ -640,8 +640,8 @@ static int s3c_camif_vidioc_querycap(struct file *file, void *priv,
|
||||
{
|
||||
struct camif_vp *vp = video_drvdata(file);
|
||||
|
||||
strlcpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver));
|
||||
strlcpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card));
|
||||
strscpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s.%d",
|
||||
dev_name(vp->camif->dev), vp->id);
|
||||
|
||||
@@ -661,7 +661,7 @@ static int s3c_camif_vidioc_enum_input(struct file *file, void *priv,
|
||||
return -EINVAL;
|
||||
|
||||
input->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
strlcpy(input->name, sensor->name, sizeof(input->name));
|
||||
strscpy(input->name, sensor->name, sizeof(input->name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ static int s3c_camif_vidioc_enum_fmt(struct file *file, void *priv,
|
||||
if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
strlcpy(f->description, fmt->name, sizeof(f->description));
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
f->pixelformat = fmt->fourcc;
|
||||
|
||||
pr_debug("fmt(%d): %s\n", f->index, f->description);
|
||||
@@ -1555,7 +1555,7 @@ int s3c_camif_create_subdev(struct camif_dev *camif)
|
||||
|
||||
v4l2_subdev_init(sd, &s3c_camif_subdev_ops);
|
||||
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
|
||||
strlcpy(sd->name, "S3C-CAMIF", sizeof(sd->name));
|
||||
strscpy(sd->name, "S3C-CAMIF", sizeof(sd->name));
|
||||
|
||||
camif->pads[CAMIF_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
|
||||
camif->pads[CAMIF_SD_PAD_SOURCE_C].flags = MEDIA_PAD_FL_SOURCE;
|
||||
|
@@ -316,12 +316,12 @@ static int camif_media_dev_init(struct camif_dev *camif)
|
||||
memset(md, 0, sizeof(*md));
|
||||
snprintf(md->model, sizeof(md->model), "SAMSUNG S3C%s CAMIF",
|
||||
ip_rev == S3C6410_CAMIF_IP_REV ? "6410" : "244X");
|
||||
strlcpy(md->bus_info, "platform", sizeof(md->bus_info));
|
||||
strscpy(md->bus_info, "platform", sizeof(md->bus_info));
|
||||
md->hw_revision = ip_rev;
|
||||
|
||||
md->dev = camif->dev;
|
||||
|
||||
strlcpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name));
|
||||
strscpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name));
|
||||
v4l2_dev->mdev = md;
|
||||
|
||||
media_device_init(md);
|
||||
|
新しいイシューから参照
ユーザーをブロックする