media: v4l: ioctl: Validate num_planes for debug messages
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 10 Jan 2019 14:24:26 +0000 (09:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Jan 2019 07:09:49 +0000 (08:09 +0100)
commit71a41c7d322f72d6cecc972ae1e112dae8790470
treec0b8b53a1f11bf92221909f0047d3820e2db5f78
parent501f37b68703b09bfaaaa2b5196f58d7a80ca3f9
media: v4l: ioctl: Validate num_planes for debug messages

commit 7fe9f01c04c2673bd6662c35b664f0f91888b96f upstream.

The num_planes field in struct v4l2_pix_format_mplane is used in a loop
before validating it. As the use is printing a debug message in this case,
just cap the value to the maximum allowed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: <stable@vger.kernel.org> # for v4.12 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-ioctl.c