Merge "fbdev: use unsigned integers to prevent overflow"
This commit is contained in:
commit
65767b7f53
1 changed files with 4 additions and 4 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue