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

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

Merge "fbdev: use unsigned integers to prevent overflow"

parents 5ea13e43 aae72283
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -187,8 +187,8 @@ int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to)

int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to)
{
	int tooff = 0, fromoff = 0;
	int size;
	u32 tooff = 0, fromoff = 0;
	u32 size;

	if (to->start > from->start)
		fromoff = to->start - from->start;
@@ -198,10 +198,10 @@ int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to)
		return -EINVAL;

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

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