Skip to content

Commit

Permalink
[media] ivtvfb: Add sanity check to ivtvfb_pan_display()
Browse files Browse the repository at this point in the history
Add sanity check to ivtvfb_pan_display() to ensure only valid values are used
to pan the display. Invalid values are rejected with -EINVAL

Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Ian Armstrong authored and Mauro Carvalho Chehab committed Jun 1, 2011
1 parent 5d9c08d commit 6600cc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/video/ivtv/ivtvfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,10 @@ static int ivtvfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *inf
u32 osd_pan_index;
struct ivtv *itv = (struct ivtv *) info->par;

if (var->yoffset + info->var.yres > info->var.yres_virtual ||
var->xoffset + info->var.xres > info->var.xres_virtual)
return -EINVAL;

osd_pan_index = var->yoffset * info->fix.line_length
+ var->xoffset * info->var.bits_per_pixel / 8;
write_reg(osd_pan_index, 0x02A0C);
Expand Down

0 comments on commit 6600cc3

Please sign in to comment.