summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorDavid Sterba2014-02-03 18:24:09 +0100
committerJosef Bacik2014-03-10 20:15:44 +0100
commit64792f253508268eb390a86f42f128d877b40776 (patch)
tree7daf4e281e32054614337266f57797b1b02c5cea /fs/btrfs/send.c
parentBtrfs: more send support for parent/child dir relationship inversion (diff)
downloadkernel-qcow2-linux-64792f253508268eb390a86f42f128d877b40776.tar.gz
kernel-qcow2-linux-64792f253508268eb390a86f42f128d877b40776.tar.xz
kernel-qcow2-linux-64792f253508268eb390a86f42f128d877b40776.zip
btrfs: send: replace check with an assert in gen_unique_name
The buffer passed to snprintf can hold the fully expanded format string, 64 = 3x largest ULL + 3x char + trailing null. I don't think that removing the check entirely is a good idea, hence the ASSERT. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 154a717d2a3c..08edd0a7fff1 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1418,11 +1418,7 @@ static int gen_unique_name(struct send_ctx *sctx,
while (1) {
len = snprintf(tmp, sizeof(tmp), "o%llu-%llu-%llu",
ino, gen, idx);
- if (len >= sizeof(tmp)) {
- /* should really not happen */
- ret = -EOVERFLOW;
- goto out;
- }
+ ASSERT(len < sizeof(tmp));
di = btrfs_lookup_dir_item(NULL, sctx->send_root,
path, BTRFS_FIRST_FREE_OBJECTID,