From: Damien Le Moal <dlemoal@kernel.org>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Jens Axboe <axboe@kernel.dk>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux-btrace@vger.kernel.org,
John Garry <john.g.garry@oracle.com>,
Hannes Reinecke <hare@suse.de>, Christoph Hellwig <hch@lst.de>,
Naohiro Aota <naohiro.aota@wdc.com>,
Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Chaitanya Kulkarni <chaitanyak@nvidia.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH blktrace v2 02/22] blkparse: fix compiler warning
Date: Wed, 1 Oct 2025 16:43:11 +0900 [thread overview]
Message-ID: <6eb2eab1-7a9c-4c07-a9b1-be6557247a4c@kernel.org> (raw)
In-Reply-To: <20250925150427.67394-3-johannes.thumshirn@wdc.com>
On 9/26/25 00:04, Johannes Thumshirn wrote:
> GCC (15.2.1) warns on about the following string truncation in blkparse.c
>
> gcc -o blkparse.o -c -Wall -O2 -g -W -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 blkparse.c
> blkparse.c: In function ‘main’:
> blkparse.c:2103:68: warning: ‘):’ directive output may be truncated writing 2 bytes into a region of size between 1 and 41 [-Wformat-truncation=]
> 2103 | snprintf(line, sizeof(line) - 1, "CPU%d (%s):",
> | ^~
> In function ‘show_device_and_cpu_stats’,
> inlined from ‘show_stats’ at blkparse.c:3064:3,
> inlined from ‘main’ at blkparse.c:3386:3:
> blkparse.c:2103:25: note: ‘snprintf’ output between 9 and 49 bytes into a destination of size 47
> 2103 | snprintf(line, sizeof(line) - 1, "CPU%d (%s):",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2104 | j, get_dev_name(pdi, name, sizeof(name)));
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> gcc -Wall -O2 -g -W -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o blkparse blkparse.o blkparse_fmt.o rbtree.o act_mask.o
>
> Add two more bytes to the string in order to mitigate the compiler warning.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-10-01 7:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 15:04 [PATCH blktrace v2 00/22] blktrace: Add user-space support for zoned command tracing Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 01/22] blktrace: fix comment for struct blk_trace_setup: Johannes Thumshirn
2025-10-01 7:41 ` Damien Le Moal
2025-09-25 15:04 ` [PATCH blktrace v2 02/22] blkparse: fix compiler warning Johannes Thumshirn
2025-10-01 7:43 ` Damien Le Moal [this message]
2025-09-25 15:04 ` [PATCH blktrace v2 03/22] blktrace: add definitions for BLKTRACESETUP2 Johannes Thumshirn
2025-10-01 7:48 ` Damien Le Moal
2025-09-25 15:04 ` [PATCH blktrace v2 04/22] blktrace: change size of action to 64 bits Johannes Thumshirn
2025-10-01 7:51 ` Damien Le Moal
2025-09-25 15:04 ` [PATCH blktrace v2 05/22] blktrace: add definitions for blk_io_trace2 Johannes Thumshirn
2025-10-01 7:53 ` Damien Le Moal
2025-09-25 15:04 ` [PATCH blktrace v2 06/22] blktrace: support protocol version 8 Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 07/22] blkparse: pass magic to get_magic Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 08/22] blkparse: read 'magic' first Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 09/22] blkparse: factor out reading of a singe blk_io_trace event Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 10/22] blkparse: skip unsupported protocol versions Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 11/22] blkparse: make get_pdulen() take the pdu_len Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 12/22] blkiomon: read 'magic' first Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 13/22] blktrace: pass magic to CHECK_MAGIC macro Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 14/22] blktrace: pass magic to verify_trace Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 15/22] blktrace: rename trace_to_cpu to bit_trace_to_cpu Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 16/22] blkparse: use blk_io_trace2 internally Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 17/22] blkparse: natively parse blk_io_trace2 Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 18/22] blkparse: parse zone (un)plug actions Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 19/22] blkparse: add zoned commands to fill_rwbs() Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 20/22] blkparse: parse zone management commands Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 21/22] blkparse: parse zone append completions Johannes Thumshirn
2025-09-25 15:04 ` [PATCH blktrace v2 22/22] blktrace: call BLKTRACESETUP2 ioctl per default to setup a trace Johannes Thumshirn
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=6eb2eab1-7a9c-4c07-a9b1-be6557247a4c@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=chaitanyak@nvidia.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=john.g.garry@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrace@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=rostedt@goodmis.org \
--cc=shinichiro.kawasaki@wdc.com \
/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).