diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-10-14 03:40:30 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-10-14 03:40:29 -0700 |
| commit | 65767b7f53b3870d7663f9fa282ec4a6de786d49 (patch) | |
| tree | eba906075ef9954890202f7715a09b4cfbe60030 | |
| parent | c116fa434fa09d17890612a8983f3d68f46821a6 (diff) | |
| parent | d62ac6e45b536bacb564a40563da352126c74e75 (diff) | |
Merge "fbdev: use unsigned integers to prevent overflow"
| -rw-r--r-- | drivers/video/fbdev/core/fbcmap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c index 6bf80e43cac5..021755f7f32d 100644 --- a/drivers/video/fbdev/core/fbcmap.c +++ b/drivers/video/fbdev/core/fbcmap.c @@ -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)) |
