Skip to content
Snippets Groups Projects
Commit 2297be90 authored by Hans Verkuil's avatar Hans Verkuil Committed by Frieder Schrempf
Browse files

media: pci: cx23885: check cx23885_vdev_init() return


[ Upstream commit 15126b91 ]

cx23885_vdev_init() can return a NULL pointer, but that pointer
is used in the next line without a check.

Add a NULL pointer check and go to the error unwind if it is NULL.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: default avatarSicong Huang <huangsicong@iie.ac.cn>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 01c75d84
No related branches found
No related tags found
1 merge request!167🤖 Sync Bot: Update v5.4-ktn to Latest Stable Kernel (v5.4.283)
...@@ -1299,6 +1299,10 @@ int cx23885_video_register(struct cx23885_dev *dev) ...@@ -1299,6 +1299,10 @@ int cx23885_video_register(struct cx23885_dev *dev)
/* register Video device */ /* register Video device */
dev->video_dev = cx23885_vdev_init(dev, dev->pci, dev->video_dev = cx23885_vdev_init(dev, dev->pci,
&cx23885_video_template, "video"); &cx23885_video_template, "video");
if (!dev->video_dev) {
err = -ENOMEM;
goto fail_unreg;
}
dev->video_dev->queue = &dev->vb2_vidq; dev->video_dev->queue = &dev->vb2_vidq;
dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE; V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE;
...@@ -1317,6 +1321,10 @@ int cx23885_video_register(struct cx23885_dev *dev) ...@@ -1317,6 +1321,10 @@ int cx23885_video_register(struct cx23885_dev *dev)
/* register VBI device */ /* register VBI device */
dev->vbi_dev = cx23885_vdev_init(dev, dev->pci, dev->vbi_dev = cx23885_vdev_init(dev, dev->pci,
&cx23885_vbi_template, "vbi"); &cx23885_vbi_template, "vbi");
if (!dev->vbi_dev) {
err = -ENOMEM;
goto fail_unreg;
}
dev->vbi_dev->queue = &dev->vb2_vbiq; dev->vbi_dev->queue = &dev->vb2_vbiq;
dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE; V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment