upstream: cx88: fix register mask
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 29 May 2013 09:22:02 +0000 (06:22 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:55:18 +0000 (11:55 +0900)
Ensure that the register is aligned to a dword, otherwise the read could
read out-of-range data.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/cx88/cx88-video.c

index cdb75a2..4f9f1c8 100644 (file)
@@ -1372,7 +1372,7 @@ static int vidioc_g_register (struct file *file, void *fh,
        if (!v4l2_chip_match_host(&reg->match))
                return -EINVAL;
        /* cx2388x has a 24-bit register space */
-       reg->val = cx_read(reg->reg & 0xffffff);
+       reg->val = cx_read(reg->reg & 0xfffffc);
        reg->size = 4;
        return 0;
 }
@@ -1384,7 +1384,7 @@ static int vidioc_s_register (struct file *file, void *fh,
 
        if (!v4l2_chip_match_host(&reg->match))
                return -EINVAL;
-       cx_write(reg->reg & 0xffffff, reg->val);
+       cx_write(reg->reg & 0xfffffc, reg->val);
        return 0;
 }
 #endif