[Intel-gfx] [PATCH 02/16] drm/i915: Refactor pwrite/pread to use single copy of get_user_pages
Keith Packard
keithp at keithp.com
Fri May 13 02:21:50 CEST 2011
On Thu, 12 May 2011 22:17:10 +0100, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> + pages = kmalloc(n*sizeof(struct page *),
> + GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
> + if (pages == NULL) {
> + pages = drm_malloc_ab(n, sizeof(struct page *));
> + if (pages == NULL) {
> + *pages_out = NULL;
> + *num_pages = 0;
> + return -ENOMEM;
> + }
> + }
Please use drm_malloc_ab here unconditionally; you've got a potential
multiplication overflow, and drm_malloc_ab already uses kmalloc for
small amounts anyways.
Otherwise, this looks good to me.
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20110512/bf7f5d82/attachment.sig>
More information about the Intel-gfx
mailing list