From 771d77339b0f7a236d1fc0ef414469b4282b47a9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 29 May 2013 07:00:08 -0300 Subject: [media] cx18: fix register range check 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 Cc: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx18/cx18-ioctl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/media/pci/cx18') diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 414b0ecccc91..1110bcb14e2f 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -367,6 +367,8 @@ static int cx18_g_register(struct file *file, void *fh, { struct cx18 *cx = fh2id(fh)->cx; + if (reg->reg & 0x3) + return -EINVAL; if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) return -EINVAL; reg->size = 4; @@ -379,6 +381,8 @@ static int cx18_s_register(struct file *file, void *fh, { struct cx18 *cx = fh2id(fh)->cx; + if (reg->reg & 0x3) + return -EINVAL; if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) return -EINVAL; cx18_write_enc(cx, reg->val, reg->reg); -- cgit v1.2.3