[media] ivtv: fix register range check
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 29 May 2013 10:00:10 +0000 (07:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 17 Jun 2013 12:17:27 +0000 (09:17 -0300)
Ensure that the register is aligned to a dword, otherwise the range check
could fail since it assumes dword alignment.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/ivtv/ivtv-ioctl.c

index 944300f7c60b97d9c6f00e395d9c65c3002851df..807b275a847e696b762c10d083874b618d30ee89 100644 (file)
@@ -696,6 +696,8 @@ static int ivtv_itvc(struct ivtv *itv, bool get, u64 reg, u64 *val)
 {
        volatile u8 __iomem *reg_start;
 
+       if (reg & 0x3)
+               return -EINVAL;
        if (reg >= IVTV_REG_OFFSET && reg < IVTV_REG_OFFSET + IVTV_REG_SIZE)
                reg_start = itv->reg_mem - IVTV_REG_OFFSET;
        else if (itv->has_cx23415 && reg >= IVTV_DECODER_OFFSET &&