diff options
author | Ian Armstrong <ian@iarmst.demon.co.uk> | 2011-05-28 21:15:41 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-06-01 07:45:36 -0400 |
commit | 6600cc301d0762e3db8bd2b44d2d5fef36a4fd68 (patch) | |
tree | 4f68a7ca392e1df8999fec0ef5033008a2e35fe6 /drivers/media/video/ivtv | |
parent | 5d9c08dea0c13c09408f97fe61d34c198c4f3277 (diff) |
[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 <ian@iarmst.demon.co.uk>
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtvfb.c | 4 |
1 files changed, 4 insertions, 0 deletions
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 | |||
836 | u32 osd_pan_index; | 836 | u32 osd_pan_index; |
837 | struct ivtv *itv = (struct ivtv *) info->par; | 837 | struct ivtv *itv = (struct ivtv *) info->par; |
838 | 838 | ||
839 | if (var->yoffset + info->var.yres > info->var.yres_virtual || | ||
840 | var->xoffset + info->var.xres > info->var.xres_virtual) | ||
841 | return -EINVAL; | ||
842 | |||
839 | osd_pan_index = var->yoffset * info->fix.line_length | 843 | osd_pan_index = var->yoffset * info->fix.line_length |
840 | + var->xoffset * info->var.bits_per_pixel / 8; | 844 | + var->xoffset * info->var.bits_per_pixel / 8; |
841 | write_reg(osd_pan_index, 0x02A0C); | 845 | write_reg(osd_pan_index, 0x02A0C); |