trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinson Lee <vlee@freedesktop.org>
To: trinity@vger.kernel.org
Subject: [PATCH] fds/drm.c: Increase buffer size.
Date: Tue, 28 Feb 2017 19:49:16 +0000	[thread overview]
Message-ID: <1488311356-12461-1-git-send-email-vlee@freedesktop.org> (raw)

Fix GCC format-truncation error.

  CC	fds/drm.o
fds/drm.c: In function ‘open_drm_fds’:
fds/drm.c:106:40: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 119 [-Werror=format-truncation=]
   snprintf(buf, sizeof(buf), "/dev/dri/%s", entry->d_name);
                                        ^~
In file included from /usr/include/stdio.h:939:0,
                 from include/list.h:3,
                 from include/fd.h:3,
                 from fds/drm.c:4:
/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 10 and 265 bytes into a destination of size 128
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 fds/drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fds/drm.c b/fds/drm.c
index 1f7b95f1eb34..b094183d8d0d 100644
--- a/fds/drm.c
+++ b/fds/drm.c
@@ -83,7 +83,7 @@ static int open_drm_fds(void)
 	int fd, dfd;
 	DIR *dir;
 	struct dirent *entry;
-	char buf[128];
+	char buf[512];
 
 	head = get_objhead(OBJ_GLOBAL, OBJ_FD_DRM);
 	head->destroy = &drmfd_destructor;
-- 
2.11.1

             reply	other threads:[~2017-02-28 19:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 19:49 Vinson Lee [this message]
     [not found] ` <20170228210855.sj2zpdw3fusqh4hv@codemonkey.org.uk>
2017-02-28 22:59   ` [PATCH] fds/drm.c: Increase buffer size Vinson Lee
2017-02-28 23:02     ` Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488311356-12461-1-git-send-email-vlee@freedesktop.org \
    --to=vlee@freedesktop.org \
    --cc=trinity@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).