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:46:53 +0300 Message-ID: <20150609224653.GC3210@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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0671437043==" Return-path: Received: from pegasus3.altlinux.org (pegasus3.altlinux.org [194.107.17.103]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E2C16E018 for ; Tue, 9 Jun 2015 15:46:55 -0700 (PDT) In-Reply-To: <1433849204-4125-5-git-send-email-patrik.jakobsson@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Patrik Jakobsson Cc: intel-gfx@lists.freedesktop.org, strace-devel@lists.sourceforge.net List-Id: intel-gfx@lists.freedesktop.org --===============0671437043== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="i7F3eY7HS/tUJxUd" Content-Disposition: inline --i7F3eY7HS/tUJxUd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 09, 2015 at 01:26:44PM +0200, Patrik Jakobsson wrote: [...] > +static int drm_version(struct tcb *tcp, const unsigned int code, long ar= g) > +{ > + 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); > + if (!name) > + return 0; > + ret =3D umovestr(tcp, (long)ver.name, ver.name_len, name); > + if (ret < 0) > + goto free_name; No need to allocate (arbitrary sized chunk of) memory just to fetch a string that has to be printed. There is a function called printstr() to print such strings in a properly quoted form. --=20 ldv --i7F3eY7HS/tUJxUd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlV3bN0ACgkQfKvmrJ41Nh6VNgCgjE+4+muCKfe+UySaA0ms4Qaf 4uIAn2JkPAr4hBRCWKVLqueQtybY/7zw =k2on -----END PGP SIGNATURE----- --i7F3eY7HS/tUJxUd-- --===============0671437043== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============0671437043==--