Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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 <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
771d7733 15c4fee3

+4
+4
drivers/media/pci/cx18/cx18-ioctl.c
··· 367 367 { 368 368 struct cx18 *cx = fh2id(fh)->cx; 369 369 370 + if (reg->reg & 0x3) 371 + return -EINVAL; 370 372 if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) 371 373 return -EINVAL; 372 374 reg->size = 4; ··· 381 379 { 382 380 struct cx18 *cx = fh2id(fh)->cx; 383 381 382 + if (reg->reg & 0x3) 383 + return -EINVAL; 384 384 if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) 385 385 return -EINVAL; 386 386 cx18_write_enc(cx, reg->val, reg->reg);