summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-08 16:33:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-08 16:33:21 +0300
commitba1cb318dcbfc9754acda9656262aea97ebe77e6 (patch)
tree770fadb8b2c77da5d4dd9d33535b2d7adcdb02fd /drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
parent8f523d6db7ed69f69720267af170c0719023f373 (diff)
parent0238df646e6224016a45505d2c111a24669ebe21 (diff)
downloadlinux-ba1cb318dcbfc9754acda9656262aea97ebe77e6.tar.xz
Merge 4.19-rc7 into char-misc-next
We want the fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c')
-rw-r--r--drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c b/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
index ef69273074ba..a3edb20ea4c3 100644
--- a/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
@@ -496,6 +496,9 @@ static int omapfb_memory_read(struct fb_info *fbi,
if (!access_ok(VERIFY_WRITE, mr->buffer, mr->buffer_size))
return -EFAULT;
+ if (mr->w > 4096 || mr->h > 4096)
+ return -EINVAL;
+
if (mr->w * mr->h * 3 > mr->buffer_size)
return -EINVAL;
@@ -509,7 +512,7 @@ static int omapfb_memory_read(struct fb_info *fbi,
mr->x, mr->y, mr->w, mr->h);
if (r > 0) {
- if (copy_to_user(mr->buffer, buf, mr->buffer_size))
+ if (copy_to_user(mr->buffer, buf, r))
r = -EFAULT;
}