mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:00:53 +07:00
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>
This commit is contained in:
parent
5ed7f9ff15
commit
64792f2535
@ -1418,11 +1418,7 @@ static int gen_unique_name(struct send_ctx *sctx,
|
|||||||
while (1) {
|
while (1) {
|
||||||
len = snprintf(tmp, sizeof(tmp), "o%llu-%llu-%llu",
|
len = snprintf(tmp, sizeof(tmp), "o%llu-%llu-%llu",
|
||||||
ino, gen, idx);
|
ino, gen, idx);
|
||||||
if (len >= sizeof(tmp)) {
|
ASSERT(len < sizeof(tmp));
|
||||||
/* should really not happen */
|
|
||||||
ret = -EOVERFLOW;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
di = btrfs_lookup_dir_item(NULL, sctx->send_root,
|
di = btrfs_lookup_dir_item(NULL, sctx->send_root,
|
||||||
path, BTRFS_FIRST_FREE_OBJECTID,
|
path, BTRFS_FIRST_FREE_OBJECTID,
|
||||||
|
Loading…
Reference in New Issue
Block a user