[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>
This commit is contained in:
parent
15c4fee344
commit
771d77339b
1 changed files with 4 additions and 0 deletions
|
@ -367,6 +367,8 @@ static int cx18_g_register(struct file *file, void *fh,
|
||||||
{
|
{
|
||||||
struct cx18 *cx = fh2id(fh)->cx;
|
struct cx18 *cx = fh2id(fh)->cx;
|
||||||
|
|
||||||
|
if (reg->reg & 0x3)
|
||||||
|
return -EINVAL;
|
||||||
if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE)
|
if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
reg->size = 4;
|
reg->size = 4;
|
||||||
|
@ -379,6 +381,8 @@ static int cx18_s_register(struct file *file, void *fh,
|
||||||
{
|
{
|
||||||
struct cx18 *cx = fh2id(fh)->cx;
|
struct cx18 *cx = fh2id(fh)->cx;
|
||||||
|
|
||||||
|
if (reg->reg & 0x3)
|
||||||
|
return -EINVAL;
|
||||||
if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE)
|
if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
cx18_write_enc(cx, reg->val, reg->reg);
|
cx18_write_enc(cx, reg->val, reg->reg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue