[media] cx88: fix register mask
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 29 May 2013 09:22:02 +0000 (06:22 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 21 Jun 2013 13:48:18 +0000 (10:48 -0300)
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 5b26ece..ecf21d9 100644 (file)
@@ -1360,7 +1360,7 @@ static int vidioc_g_register (struct file *file, void *fh,
        struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
 
        /* 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;
 }
@@ -1370,7 +1370,7 @@ static int vidioc_s_register (struct file *file, void *fh,
 {
        struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
 
-       cx_write(reg->reg & 0xffffff, reg->val);
+       cx_write(reg->reg & 0xfffffc, reg->val);
        return 0;
 }
 #endif