]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/video/fbdev/sbuslib.c
fbdev: sbuslib: integer overflow in sbusfb_ioctl_helper()
[mirror_ubuntu-bionic-kernel.git] / drivers / video / fbdev / sbuslib.c
index 90c51330969c2f027b4e2e83f98457db7f0265cf..01a7110e61a76a19167fae82d71e1f9efdb312e3 100644 (file)
@@ -171,7 +171,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
                    get_user(ublue, &c->blue))
                        return -EFAULT;
 
-               if (index + count > cmap->len)
+               if (index > cmap->len || count > cmap->len - index)
                        return -EINVAL;
 
                for (i = 0; i < count; i++) {