From: Alexander Aring <aahringo@redhat.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Christine Caulfield <ccaulfie@redhat.com>,
David Teigland <teigland@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
gfs2@lists.linux.dev
Subject: Re: [PATCH 2/3] fs: dlm: Fix the size of a buffer in dlm_create_debug_file()
Date: Fri, 22 Sep 2023 16:03:00 -0400 [thread overview]
Message-ID: <CAK-6q+ifLNmM_nT5MGy9SPAmx61=AogkyNsGw=yPdYPsUsFcyg@mail.gmail.com> (raw)
In-Reply-To: <6083c5d6e7e4eb567bf6f5cbb5bdf6b0286cee45.1695403360.git.christophe.jaillet@wanadoo.fr>
Hi,
On Fri, Sep 22, 2023 at 1:38 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> 8 is not the maximum size of the suffix used when creating debugfs files.
>
> Let the compiler compute the correct size, and only give a hint about the
> longest possible string that is used.
>
> When building with W=1, this fixes the following warnings:
>
> fs/dlm/debug_fs.c: In function ‘dlm_create_debug_file’:
> fs/dlm/debug_fs.c:1020:58: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
> 1020 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
> | ^
> fs/dlm/debug_fs.c:1020:9: note: ‘snprintf’ output between 9 and 73 bytes into a destination of size 72
> 1020 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fs/dlm/debug_fs.c:1031:50: error: ‘_queued_asts’ directive output may be truncated writing 12 bytes into a region of size between 8 and 72 [-Werror=format-truncation=]
> 1031 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name);
> | ^~~~~~~~~~~~
> fs/dlm/debug_fs.c:1031:9: note: ‘snprintf’ output between 13 and 77 bytes into a destination of size 72
> 1031 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fixes: 541adb0d4d10b ("fs: dlm: debugfs for queued callbacks")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
there is a similar patch [0] already in the queue for dlm.
- Alex
[0] https://lore.kernel.org/gfs2/20230906143153.1353077-5-aahringo@redhat.com/T/#u
next prev parent reply other threads:[~2023-09-22 20:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1695403360.git.christophe.jaillet@wanadoo.fr>
2023-09-22 17:31 ` [PATCH 1/3] fs: dlm: Simplify buffer size computation in dlm_create_debug_file() Christophe JAILLET
2023-09-22 17:31 ` [PATCH 2/3] fs: dlm: Fix the size of a buffer " Christophe JAILLET
2023-09-22 20:03 ` Alexander Aring [this message]
2023-09-22 17:31 ` [PATCH 3/3] fs: dlm: Remove some useless memset() Christophe JAILLET
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='CAK-6q+ifLNmM_nT5MGy9SPAmx61=AogkyNsGw=yPdYPsUsFcyg@mail.gmail.com' \
--to=aahringo@redhat.com \
--cc=ccaulfie@redhat.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=gfs2@lists.linux.dev \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=teigland@redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).