video: fbdev: Additional param checks on user space cmap
Additional bound checks for parameters that are used to calculate target buffer address. Change-Id: Ib4a00a51c761dc7751a19e6ee7f55cacac97860f Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
This commit is contained in:
parent
df0d2be28a
commit
488f3d81d0
1 changed files with 3 additions and 2 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue