On Thu, Sep 03, 2015 at 09:48:03PM +0100, Chris Wilson wrote: > On Thu, Sep 03, 2015 at 07:22:18PM +0200, Michał Winiarski wrote: > > + pts = kcalloc(pdpes * BITS_TO_LONGS(I915_PDES), > > + sizeof(unsigned long), GFP_TEMPORARY); > > Something to remember is that kcalloc is written presuming that the size > argument (the second) is constant. > > pts = kcalloc(pdpes, > BITS_TO_LONGS(I915_PDES) * sizeof(unsigned long), > GFP_TEMPORARY); > > should be infinitesimally more efficient. That's also better style from a security pov sinc kcalloc checks for overflows. Which means if you multiply yourself things might overflow and go boom. Luckily pdpdes is guaranteed to be small enough here, but still secure coding best practices means you better not multiply the variable. Hence I changed this. > Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Queued for -next, thanks for the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx