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

Commit 7ab22246 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "video: fbdev: Additional param checks on user space cmap"

parents 62b3870c d958e44a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -194,11 +194,12 @@ int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to)
		fromoff = to->start - from->start;
	else
		tooff = from->start - to->start;
	if ((to->len <= tooff) || (from->len <= fromoff))
		return -EINVAL;

	size = to->len - tooff;
	if (size > (int) (from->len - fromoff))
		size = from->len - fromoff;
	if (size <= 0)
		return -EINVAL;
	size *= sizeof(u16);

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