media: dvb_ca_en50221: off by one in dvb_ca_en50221_io_do_ioctl()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Jul 2018 09:48:35 +0000 (05:48 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 2 Aug 2018 18:21:39 +0000 (14:21 -0400)
The > should be >= so we don't read one element beyond the end of the
ca->slot_info[] array.  The array is allocated in dvb_ca_en50221_init().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/dvb-core/dvb_ca_en50221.c

index 1310526..4d371ce 100644 (file)
@@ -1391,7 +1391,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
                struct dvb_ca_slot *sl;
 
                slot = info->num;
-               if ((slot > ca->slot_count) || (slot < 0)) {
+               if ((slot >= ca->slot_count) || (slot < 0)) {
                        err = -EINVAL;
                        goto out_unlock;
                }