From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 4/4] btrfs-progs: Fix Wformat-overflow warning in cmds-receive.c
Date: Mon, 17 Jun 2019 15:59:36 +0800 [thread overview]
Message-ID: <20190617075936.12113-5-wqu@suse.com> (raw)
In-Reply-To: <20190617075936.12113-1-wqu@suse.com>
[BUG]
When compiling btrfs-progs with GCC 9 (9.1.0), we got the following
warnings:
In file included from utils.h:30,
from cmds-receive.c:45:
cmds-receive.c: In function 'process_subvol':
messages.h:42:3: warning: '%s' directive argument is null [-Wformat-overflow=]
42 | __btrfs_error((fmt), ##__VA_ARGS__); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmds-receive.c:178:3: note: in expansion of macro 'error'
178 | error("subvol: another one already started, path buf: %s",
| ^~~~~
[CC] cmds-inspect-tree-stats.o
cmds-receive.c: In function 'process_snapshot':
messages.h:42:3: warning: '%s' directive argument is null [-Wformat-overflow=]
42 | __btrfs_error((fmt), ##__VA_ARGS__); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmds-receive.c:248:3: note: in expansion of macro 'error'
248 | error("snapshot: another one already started, path buf: %s",
| ^~~~~
[FIX]
We're using wrong member for the error output.
Fix the member to output.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
cmds-receive.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmds-receive.c b/cmds-receive.c
index fe5c3a5b05c5..07f05101f921 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -176,7 +176,7 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid,
}
if (rctx->cur_subvol_path[0]) {
error("subvol: another one already started, path buf: %s",
- rctx->cur_subvol.path);
+ rctx->cur_subvol_path);
ret = -EINVAL;
goto out;
}
@@ -246,7 +246,7 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
}
if (rctx->cur_subvol_path[0]) {
error("snapshot: another one already started, path buf: %s",
- rctx->cur_subvol.path);
+ rctx->cur_subvol_path);
ret = -EINVAL;
goto out;
}
--
2.22.0
next prev parent reply other threads:[~2019-06-17 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 7:59 [PATCH 0/4] btrfs-progs: GCC9 fixes Qu Wenruo
2019-06-17 7:59 ` [PATCH 1/4] btrfs-progs: constify extent buffer reader Qu Wenruo
2019-06-17 7:59 ` [PATCH 2/4] btrfs-progs: Fix -Waddress-of-packed-member warning in btrfs_dev_stats_values callers Qu Wenruo
2019-06-17 7:59 ` [PATCH 3/4] btrfs-progs: Remove unnecessary fallthrough attribute in test_num_disk_vs_raid() Qu Wenruo
2019-06-18 13:14 ` David Sterba
2019-06-17 7:59 ` Qu Wenruo [this message]
2019-06-18 13:20 ` [PATCH 0/4] btrfs-progs: GCC9 fixes David Sterba
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=20190617075936.12113-5-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).