]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[media] ivtvfb: Add sanity check to ivtvfb_pan_display()
authorIan Armstrong <ian@iarmst.demon.co.uk>
Sun, 29 May 2011 01:15:41 +0000 (22:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 1 Jun 2011 11:45:36 +0000 (08:45 -0300)
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>
drivers/media/video/ivtv/ivtvfb.c

index 2d5a97431c0a30fd238f6dd3f0eeab9be0670f1f..5dec2e4012bd56d91adc2ffbd4f0041900841e79 100644 (file)
@@ -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);