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-Tag: kvm-75rc1^2~15^2~4^2~46 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f3b9f50ef771670b5d94c568241d6766691c6c18;p=users%2Fdwmw2%2Flinux.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 0320fb84119cf..155fdec9ac7d7 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;