From: "Maximilian Bosch" <maximilian@mbosch.me>
To: <linux-rt-users@vger.kernel.org>
Subject: Building `rt-tests` v2.9 fails with `Werror=format-overflow`
Date: Sat, 03 Jan 2026 18:27:28 +0100 [thread overview]
Message-ID: <DFF4Q0HTCC47.ZES1ZHKNABXH@mbosch.me> (raw)
Hi!
On a GCC 15.2, compiling rt-tests 2.9 fails for me with the following
error:
rt-tests> src/pmqtest/pmqtest.c: In function 'main':
rt-tests> src/pmqtest/pmqtest.c:32:21: error: '__builtin___sprintf_chk' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
rt-tests> 32 | #define TESTMQ_NAME "/testmsg%d"
rt-tests> | ^~~~~~~~~~~~
rt-tests> src/pmqtest/pmqtest.c:644:33: note: in expansion of macro 'TESTMQ_NAME'
rt-tests> 644 | sprintf(mqname, TESTMQ_NAME, i);
rt-tests> | ^~~~~~~~~~~
rt-tests> src/pmqtest/pmqtest.c:32:32: note: format string is defined here
rt-tests> 32 | #define TESTMQ_NAME "/testmsg%d"
rt-tests> | ^
I assume this is
* 8 chars for /testmsg
* 10 chars for INT_MAX
* 1 char for a minus (this probably can't happen, but the compiler still
takes it into account - I assume?)
* One nullbyte
Which can exceed the char pointer of 19 bytes by one byte.
While this is a case that won't happen (given the construction of the
for loop), the compiler still complains because of `-Werror`.
Best
Maximilian
reply other threads:[~2026-01-03 17:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=DFF4Q0HTCC47.ZES1ZHKNABXH@mbosch.me \
--to=maximilian@mbosch.me \
--cc=linux-rt-users@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