From f0bb1949e616cccae8991c5fb56848ebea6506d0 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Tue, 21 Nov 2017 14:26:07 +0100 Subject: overlay: Fix compiler warning when compiling with recent gcc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [1/316] Compiling C object 'overlay/intel-gpu-overlay@exe/overlay.c.o'. ../overlay/overlay.c: In function ‘show_gem_objects’: ../overlay/overlay.c:798:31: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 160 [-Wformat-truncation=] snprintf(buf, sizeof(buf), "%s %ldMB, %ld objects", ^~ ../overlay/overlay.c:798:30: note: using the range [-9223372036854775808, 9223372036854775807] for directive argument snprintf(buf, sizeof(buf), "%s %ldMB, %ld objects", ^~~~~~~~~~~~~~~~~~~~~~~ ../overlay/overlay.c:798:30: note: using the range [-9223372036854775808, 9223372036854775807] for directive argument ../overlay/overlay.c:798:3: note: ‘snprintf’ output between 16 and 309 bytes into a destination of size 160 snprintf(buf, sizeof(buf), "%s %ldMB, %ld objects", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ comm->name, comm->bytes >> 20, comm->count); Might as well give it the 309 bytes it wants, plus on more. :-) Signed-off-by: Maarten Lankhorst Reviewed-by: Chris Wilson --- overlay/overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'overlay') diff --git a/overlay/overlay.c b/overlay/overlay.c index b30f7a1d..4804f813 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -740,7 +740,7 @@ static void init_gem_objects(struct overlay_context *ctx, static void show_gem_objects(struct overlay_context *ctx, struct overlay_gem_objects *go) { struct gem_objects_comm *comm; - char buf[160]; + char buf[310]; cairo_pattern_t *linear; int x, y, y1, y2; -- cgit v1.2.3