Mesa (main): intel/tools: fix invalid type in argument to printf format specifier

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 09:43:53 UTC 2021


Module: Mesa
Branch: main
Commit: 14227b3364c5ed84e0dcda8e2781fe899c51edba
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=14227b3364c5ed84e0dcda8e2781fe899c51edba

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Thu Jun 24 13:22:42 2021 +0200

intel/tools: fix invalid type in argument to printf format specifier

Also mark parse_error as printf-like to catch such errors with gcc.

CID: 1473100
CID: 1473101

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

---

 src/intel/tools/aub_read.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aub_read.c b/src/intel/tools/aub_read.c
index 826ce24723a..5e23feec298 100644
--- a/src/intel/tools/aub_read.c
+++ b/src/intel/tools/aub_read.c
@@ -57,7 +57,7 @@
 #define SUBOPCODE_MEM_WRITE 0x06
 #define SUBOPCODE_VERSION   0x0e
 
-static void
+static PRINTFLIKE(3, 4) void
 parse_error(struct aub_read *read, const uint32_t *p, const char *fmt, ...)
 {
    if (!read->error)
@@ -316,7 +316,7 @@ aub_read_command(struct aub_read *read, const void *data, uint32_t data_len)
 
    if (next > end) {
       parse_error(read, data,
-            "input ends unexpectedly (command length: %d, remaining bytes: %d)\n",
+            "input ends unexpectedly (command length: %zu, remaining bytes: %zu)\n",
             (uintptr_t)next - (uintptr_t)data,
             (uintptr_t)end  - (uintptr_t)data);
       return -1;



More information about the mesa-commit mailing list