From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Packard Subject: Re: [PATCH 02/16] drm/i915: Refactor pwrite/pread to use single copy of get_user_pages Date: Thu, 12 May 2011 17:21:50 -0700 Message-ID: References: <1305235044-9159-1-git-send-email-chris@chris-wilson.co.uk> <1305235044-9159-3-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1456819680==" Return-path: Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id C963F9E7A1 for ; Thu, 12 May 2011 17:21:56 -0700 (PDT) In-Reply-To: <1305235044-9159-3-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1456819680== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable On Thu, 12 May 2011 22:17:10 +0100, Chris Wilson = wrote: > + pages =3D kmalloc(n*sizeof(struct page *), > + GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN); > + if (pages =3D=3D NULL) { > + pages =3D drm_malloc_ab(n, sizeof(struct page *)); > + if (pages =3D=3D NULL) { > + *pages_out =3D NULL; > + *num_pages =3D 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. =2D-=20 keith.packard@intel.com --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iD8DBQFNzHmfQp8BWwlsTdMRAvRlAJwO6PUt8XGOLHUfhwNQ3D4OLLh5tACfXUYi uVeKCp7465SRqaL0y32B4gI= =6mMp -----END PGP SIGNATURE----- --=-=-=-- --===============1456819680== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============1456819680==--