diff options
Diffstat (limited to 'drivers/media/usb/hdpvr/hdpvr-video.c')
-rw-r--r-- | drivers/media/usb/hdpvr/hdpvr-video.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index e082086428a4..7580fc5f2f12 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Hauppauge HD PVR USB driver - video 4 linux 2 interface * * Copyright (C) 2008 Janne Grunau (j@jannau.net) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2. - * */ #include <linux/kernel.h> @@ -769,8 +765,7 @@ static int vidioc_enum_input(struct file *file, void *_fh, struct v4l2_input *i) i->type = V4L2_INPUT_TYPE_CAMERA; - strncpy(i->name, iname[n], sizeof(i->name) - 1); - i->name[sizeof(i->name) - 1] = '\0'; + strscpy(i->name, iname[n], sizeof(i->name)); i->audioset = 1<<HDPVR_RCA_FRONT | 1<<HDPVR_RCA_BACK | 1<<HDPVR_SPDIF; @@ -841,8 +836,7 @@ static int vidioc_enumaudio(struct file *file, void *priv, audio->capability = V4L2_AUDCAP_STEREO; - strncpy(audio->name, audio_iname[n], sizeof(audio->name) - 1); - audio->name[sizeof(audio->name) - 1] = '\0'; + strscpy(audio->name, audio_iname[n], sizeof(audio->name)); return 0; } @@ -874,7 +868,6 @@ static int vidioc_g_audio(struct file *file, void *private_data, audio->index = dev->options.audio_input; audio->capability = V4L2_AUDCAP_STEREO; strscpy(audio->name, audio_iname[audio->index], sizeof(audio->name)); - audio->name[sizeof(audio->name) - 1] = '\0'; return 0; } @@ -991,7 +984,8 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *private_data, return -EINVAL; f->flags = V4L2_FMT_FLAG_COMPRESSED; - strncpy(f->description, "MPEG2-TS with AVC/AAC streams", 32); + strscpy(f->description, "MPEG2-TS with AVC/AAC streams", + sizeof(f->description)); f->pixelformat = V4L2_PIX_FMT_MPEG; return 0; |