summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-04-24 12:46:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-27 16:46:33 +0300
commita2b94c244825fb80e03a83c1d29522e6265cddef (patch)
tree82abbaa50afaeaf0c4f26107da825fe8dfb8396d /drivers/media
parentecad62adbecc3dde19a5ed239e16dbb76b958bcd (diff)
downloadlinux-a2b94c244825fb80e03a83c1d29522e6265cddef.tar.xz
media: davinci/vpbe: array underflow in vpbe_enum_outputs()
[ Upstream commit b72845ee5577b227131b1fef23f9d9a296621d7b ] In vpbe_enum_outputs() we check if (temp_index >= cfg->num_outputs) but the problem is that "temp_index" can be negative. This patch changes the types to unsigned to address this array underflow bug. Fixes: 66715cdc3224 ("[media] davinci vpbe: VPBE display driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: "Lad, Prabhakar" <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/davinci/vpbe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 1d3c13e36904..915af9ca4711 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -126,7 +126,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev,
struct v4l2_output *output)
{
struct vpbe_config *cfg = vpbe_dev->cfg;
- int temp_index = output->index;
+ unsigned int temp_index = output->index;
if (temp_index >= cfg->num_outputs)
return -EINVAL;