From: Henrik Kretzschmar Date: Wed, 3 Sep 2008 20:11:53 +0000 (-0300) Subject: V4L/DVB (8750): V4L: check inval in video_register_device_index() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f3b9f50ef771670b5d94c568241d6766691c6c18;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git V4L/DVB (8750): V4L: check inval in video_register_device_index() Better check the video_device pointer before using it. Signed-off-by: Henrik Kretzschmar Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 0320fb84119c..155fdec9ac7d 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c @@ -257,6 +257,9 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, int ret; char *name_base; + if (vfd == NULL) + return -EINVAL; + switch (type) { case VFL_TYPE_GRABBER: base = MINOR_VFL_TYPE_GRABBER_MIN;