]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: davinci/vpbe: array underflow in vpbe_enum_outputs()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 24 Apr 2019 09:46:27 +0000 (05:46 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 8 May 2019 18:02:25 +0000 (14:02 -0400)
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>
drivers/media/platform/davinci/vpbe.c
include/media/davinci/vpbe.h

index 8339163a5231e37c5c0dcb926a175bfa64fd3507..4e24f5d781f4fe96da0e43648e13190eac578b49 100644 (file)
@@ -104,7 +104,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;
index 5c31a768249201d48459e6f603d9a00df5e8cf14..f76d2f25a82474f1ab80eb7dd7004b94f288900d 100644 (file)
@@ -92,7 +92,7 @@ struct vpbe_config {
        struct encoder_config_info *ext_encoders;
        /* amplifier information goes here */
        struct amp_config_info *amp;
-       int num_outputs;
+       unsigned int num_outputs;
        /* Order is venc outputs followed by LCD and then external encoders */
        struct vpbe_output *outputs;
 };