From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dmitry V. Levin" Subject: Re: [PATCH 4/4] drm: Add decoding of DRM and KMS ioctls Date: Wed, 10 Jun 2015 01:55:49 +0300 Message-ID: <20150609225549.GD3210@altlinux.org> References: <1433849204-4125-1-git-send-email-patrik.jakobsson@linux.intel.com> <1433849204-4125-5-git-send-email-patrik.jakobsson@linux.intel.com> <20150609155108.6b83ddc3@guiness.lab.lse.epita.fr> <20150609142931.GA30866@rpjakobs-ThinkCentre-E73> <20150609163840.077f240d@guiness.lab.lse.epita.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1192684514==" Return-path: Received: from pegasus3.altlinux.org (pegasus3.altlinux.org [194.107.17.103]) by gabe.freedesktop.org (Postfix) with ESMTP id CD5D66E04A for ; Tue, 9 Jun 2015 15:55:50 -0700 (PDT) In-Reply-To: <20150609163840.077f240d@guiness.lab.lse.epita.fr> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Gabriel Laskar Cc: intel-gfx@lists.freedesktop.org, strace-devel@lists.sourceforge.net List-Id: intel-gfx@lists.freedesktop.org --===============1192684514== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C+ts3FVlLX8+P6JN" Content-Disposition: inline --C+ts3FVlLX8+P6JN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 09, 2015 at 04:38:40PM +0200, Gabriel Laskar wrote: > On Tue, 9 Jun 2015 16:29:31 +0200 > Patrik Jakobsson wrote: >=20 > > On Tue, Jun 09, 2015 at 03:51:08PM +0200, Gabriel Laskar wrote: > > > On Tue, 9 Jun 2015 13:26:44 +0200 > > > Patrik Jakobsson wrote: > > >=20 > > > > This patch adds many of the DRM and KMS ioctls. The rest can be add= ed as > > > > needed. > > > >=20 > > > > Signed-off-by: Patrik Jakobsson > > > > --- > > > > drm.c | 519 ++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++ > > > > 1 file changed, 519 insertions(+) > > > >=20 > > > > diff --git a/drm.c b/drm.c > > > > index fa98fb7..e550c34 100644 > > > > --- a/drm.c > > > > +++ b/drm.c > > > > @@ -82,6 +82,468 @@ int drm_is_driver(struct tcb *tcp, const char *= name) > > > > return strcmp(name, drv) =3D=3D 0; > > > > } > > > > =20 > > > > +static int drm_version(struct tcb *tcp, const unsigned int code, l= ong arg) > > > > +{ > > > > + struct drm_version ver; > > > > + char *name, *date, *desc; > > > > + int ret; > > > > + > > > > + if (entering(tcp) || umove(tcp, arg, &ver)) > > > > + return 0; > > > > + > > > > + name =3D calloc(ver.name_len + 1, 1); > > >=20 > > > We have some wrappers for that now, you can call xcalloc(), but it wi= ll > > > die if this does not work. Your version have the advantage of not kill > > > strace, and just not decode the argument. > > >=20 > >=20 > > If ok I'll keep it as calloc? As you say, dying here is not really necc= essary. >=20 > Yeah, that was mostly me thinking out loud. Imho, I would keep the > calloc(), but I don't know what Dmitry will prefer. Maybe for > consistency, it should be better to have an xcalloc(). The general rule is to call xcalloc() if die_out_of_memory() is the best way to handle the OOM condition. strace should neither attempt to allocate arbitrary large chunks of memory specified by user input nor die when such allocation requests fail. --=20 ldv --C+ts3FVlLX8+P6JN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlV3bvUACgkQfKvmrJ41Nh7CuACfeWiCGXoOa3uFO3/SQAKAhWPE 8l0AniQaXLSCXCNq/3unQV/KXueSik+l =st7K -----END PGP SIGNATURE----- --C+ts3FVlLX8+P6JN-- --===============1192684514== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============1192684514==--