Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 694b0c11 authored by Dhaval Patel's avatar Dhaval Patel Committed by Gerrit - the friendly Code Review server
Browse files

fbdev: check size before copying the userdata



Check cmap data size before copying the
userdata to avoid null access.

Change-Id: If75c0339cf5e0ace6a35abc625f02283cc99298c
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent 2642c0ad
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -201,6 +201,8 @@ int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to)
	if (size > (int) (from->len - fromoff))
		size = from->len - fromoff;
	size *= sizeof(u16);
	if (!size)
		return -EINVAL;

	if (copy_to_user(to->red+tooff, from->red+fromoff, size))
		return -EFAULT;