From 6600cc301d0762e3db8bd2b44d2d5fef36a4fd68 Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sat, 28 May 2011 22:15:41 -0300 Subject: [PATCH] [media] ivtvfb: Add sanity check to ivtvfb_pan_display() 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 Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtvfb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 2d5a97431c0a..5dec2e4012bd 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -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);