From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 2/3] tests/kms_cursor_crc: fix truncated warning
Date: Tue, 28 Jun 2022 14:13:17 +0100 [thread overview]
Message-ID: <20220628131318.197965-2-matthew.auld@intel.com> (raw)
In-Reply-To: <20220628131318.197965-1-matthew.auld@intel.com>
Looks reasonable to just increase the size of 'name' to avoid the
potential truncation:
../tests/kms_cursor_crc.c: In function ‘run_size_tests.constprop’:
../tests/kms_cursor_crc.c:699:50: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 4 and 14 [-Wformat-truncation=]
699 | snprintf(name, sizeof(name), "%dx%d", w, h);
| ^~
../tests/kms_cursor_crc.c:699:46: note: directive argument in the range [-2147483648, 1024]
699 | snprintf(name, sizeof(name), "%dx%d", w, h);
| ^~~~~~~
In file included from /usr/include/stdio.h:894,
from ../lib/igt_core.h:38,
from ../lib/drmtest.h:39,
from ../lib/igt.h:27,
from ../tests/kms_cursor_crc.c:25:
In function ‘snprintf’,
inlined from ‘run_size_tests.constprop’ at ../tests/kms_cursor_crc.c:699:3:
/usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 4 and 24 bytes into a destination of size 16
71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
---
tests/kms_cursor_crc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 513c9715..131fdb0a 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -691,7 +691,7 @@ static void test_rapid_movement(data_t *data)
static void run_size_tests(data_t *data, enum pipe pipe,
int w, int h)
{
- char name[16];
+ char name[32];
if (w == 0 && h == 0)
strcpy(name, "max-size");
--
2.36.1
next prev parent reply other threads:[~2022-06-28 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 13:13 [Intel-gfx] [PATCH i-g-t 1/3] lib/igt_device_scan: fix dangling pointer Matthew Auld
2022-06-28 13:13 ` Matthew Auld [this message]
2022-06-28 13:13 ` [Intel-gfx] [PATCH i-g-t 3/3] tests/amdgpu/amdgpu_command_submission: fix uaf Matthew Auld
2022-06-29 8:55 ` Gwan-gyeong Mun
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=20220628131318.197965-2-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.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