On Mon, Nov 15, 2010 at 05:48, Paul Mundt <lethal@xxxxxxxxxxxx> wrote: > On Sat, Nov 13, 2010 at 01:07:18PM +0300, Dan Carpenter wrote: >> @@ -256,8 +264,12 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) >> Â Â Â int rc, size = cmap->len * sizeof(u16); >> Â Â Â struct fb_cmap umap; >> >> + Â Â if (cmap->len * 2 > INT_MAX) Isn't that another integer overflow? I.e. should be "if (cmap->len > INT_MAX / sizeof(u16))" instead? >> + Â Â Â Â Â Â return -EINVAL; >> + >> Â Â Â memset(&umap, 0, sizeof(struct fb_cmap)); >> - Â Â rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL); >> + Â Â rc = fb_alloc_cmap_gfp(&umap, cmap->len, cmap->transp != NULL, >> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â GFP_KERNEL); >> Â Â Â if (rc) >> Â Â Â Â Â Â Â return rc; >> Â Â Â if (copy_from_user(umap.red, cmap->red, size) || > > This looks reasonable, but it probably makes more sense to use -E2BIG > for the overflow case (as other cases are doing already), and also just > to check size directly rather than open-coding the * 2. Gr{oetje,eeting}s, Â Â Â Â Â Â Â Â Â Â Â Â Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ ÂÂ -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html