From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dmitry V. Levin" Subject: Re: [PATCH v4 3/5] drm: Add dispatcher and driver identification for DRM Date: Tue, 24 Nov 2015 08:53:01 +0300 Message-ID: <20151124055301.GC32257@altlinux.org> References: <1440420170-13337-1-git-send-email-patrik.jakobsson@linux.intel.com> <1440420170-13337-4-git-send-email-patrik.jakobsson@linux.intel.com> <20150908003624.GA17781@altlinux.org> <20150911105706.GA28550@patrik-desktop.isw.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0970184203==" Return-path: Received: from pegasus3.altlinux.org (pegasus3.altlinux.org [194.107.17.103]) by gabe.freedesktop.org (Postfix) with ESMTP id 2682A6E833 for ; Mon, 23 Nov 2015 21:53:02 -0800 (PST) In-Reply-To: <20150911105706.GA28550@patrik-desktop.isw.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 --===============0970184203== Content-Type: multipart/signed; micalg=x-unknown; protocol="application/pgp-signature"; boundary="QRj9sO5tAVLaXnSD" Content-Disposition: inline --QRj9sO5tAVLaXnSD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 11, 2015 at 12:57:06PM +0200, Patrik Jakobsson wrote: > On Tue, Sep 08, 2015 at 03:36:25AM +0300, Dmitry V. Levin wrote: > > On Mon, Aug 24, 2015 at 02:42:48PM +0200, Patrik Jakobsson wrote: [...] > > > +static char *drm_get_driver_name(struct tcb *tcp) > > > +{ > > > + char path[PATH_MAX]; > > > + char link[PATH_MAX]; > > > + int ret; > > > + > > > + if (getfdpath(tcp, tcp->u_arg[0], path, PATH_MAX - 1) < 0) > > > + return NULL; > > > + > > > + snprintf(link, PATH_MAX, "/sys/class/drm/%s/device/driver", > > > + basename(path)); > >=20 > > if (snprintf(link, sizeof(link), ...) >=3D sizeof(link)) > > return NULL; > >=20 >=20 > According to manpage snprintf never returns more than the specified size = - 1. Really? "The functions snprintf() and vsnprintf() do not write more than size bytes (including the terminating null byte ('\0')). If the output was truncated due to this limit, then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. Thus, a return value of size or more means that the output was truncated." --=20 ldv --QRj9sO5tAVLaXnSD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJWU/s8AAoJEAVFT+BVnCUIJ/oQAM/M9amDa0Z17gAzrpXFSrgj n4RrWGZfydsdz+nVIzpRhP5OQL38atp4TB5OjehuFJ0pIgiME8OhN2fXTJcH3Yoc 1fSC0VMlZpG0qMKKpO6+Eg8WsOU2ywCawOXH3VWy6EbDY0OjDGILrZALUtas5N8X 6FcOnVQthk9WbbLHp9aNzvqb6kOsfcqGp+DoZQHVvbTsvTJHqI3h3DovHBYrKdiv 4AVOafwBzQvkuAQBtIXqMzxnmKyv65+ydiKOoLSGMIoXHBOIzWokke5LBejrKhco truvsgfLmN4QQOo0oXDDuPHGxb+5/tZzPfNCf3FLclyayuGRz7apmqGUK+Y+5zsp xmJ/tg/g8f7GlDD4XgUpgM+Tu6E5JT4wZe8N6S8MIvLdTamNuhQg8g02tAo0xD0i fde1f98+WMDdzYaXZBdt5DO6ZG3fpB5kOr7m745z9Q8bKiMusvJ16aAa7VU2LD1R 2YSgebKQbrM3Ac2NMIp6aDg7R1Dfz/jD9RWP60dk/BSygd50dviAP/qPgmzsDQor GklOYGQ1yAL7+jrYNcOJWpZvUVgKriKfqgNjkGCkOe8OmHtN9XxbAq6smPYGrT1z HtVdb6kceLvyjbmiRV/4rvZIm+UDHzck7998CfJio9S6PVcgVPyaYp1M5iJu4w9S uNpw4F5r444WGM2Q9liE =oc3H -----END PGP SIGNATURE----- --QRj9sO5tAVLaXnSD-- --===============0970184203== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============0970184203==--