[media] saa7134: check register address in g_register
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 29 May 2013 09:59:59 +0000 (06:59 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 17 Jun 2013 11:53:22 +0000 (08:53 -0300)
Prevent reading out-of-range register values.

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

index 737e643be27a2007b2184122943dc70d07125502..db4cc1c54aa679fed7c60a5003663d27c9056ca9 100644 (file)
@@ -2258,7 +2258,7 @@ static int vidioc_g_register (struct file *file, void *priv,
        struct saa7134_fh *fh = priv;
        struct saa7134_dev *dev = fh->dev;
 
-       reg->val = saa_readb(reg->reg);
+       reg->val = saa_readb(reg->reg & 0xffffff);
        reg->size = 1;
        return 0;
 }
@@ -2269,7 +2269,7 @@ static int vidioc_s_register (struct file *file, void *priv,
        struct saa7134_fh *fh = priv;
        struct saa7134_dev *dev = fh->dev;
 
-       saa_writeb(reg->reg&0xffffff, reg->val);
+       saa_writeb(reg->reg & 0xffffff, reg->val);
        return 0;
 }
 #endif