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)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 16 Jan 2019 16:12:38 +0000 (11:12 -0500)
commit7fe9f01c04c2673bd6662c35b664f0f91888b96f
treef244e1df17f4af3b6c486e08294f696c14eae3a4
parent9048b2e15b11c591c649cc6edc7a64fa62c15419
media: v4l: ioctl: Validate num_planes for debug messages

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>
drivers/media/v4l2-core/v4l2-ioctl.c