소스 검색

media: dvb_ca_en50221: off by one in dvb_ca_en50221_io_do_ioctl()

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>
Dan Carpenter 7 년 전
부모
커밋
6706fe55af
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/media/dvb-core/dvb_ca_en50221.c

+ 1 - 1
drivers/media/dvb-core/dvb_ca_en50221.c

@@ -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;
 		}