summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2022-03-17 10:25:38 -0700
committerDavid Sterba <dsterba@suse.com>2022-07-25 17:45:32 +0200
commit54cab6aff811d328c5add37e0faf32f6328741ea (patch)
tree6217601c6178ee3cdf4381232e54a0491058aa4b /fs/btrfs/send.c
parentca182acc53df2ab795354c535dfd966d0fa2ae8b (diff)
downloadlinux-54cab6aff811d328c5add37e0faf32f6328741ea.tar.bz2
btrfs: send: explicitly number commands and attributes
Commit e77fbf990316 ("btrfs: send: prepare for v2 protocol") added _BTRFS_SEND_C_MAX_V* macros equal to the maximum command number for the version plus 1, but as written this creates gaps in the number space. The maximum command number is currently 22, and __BTRFS_SEND_C_MAX_V1 is accordingly 23. But then __BTRFS_SEND_C_MAX_V2 is 24, suggesting that v2 has a command numbered 23, and __BTRFS_SEND_C_MAX is 25, suggesting that 23 and 24 are valid commands. Instead, let's explicitly number all of the commands, attributes, and sentinel MAX constants. Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index cbf894fa79df..237753860758 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -333,8 +333,8 @@ __maybe_unused
static bool proto_cmd_ok(const struct send_ctx *sctx, int cmd)
{
switch (sctx->proto) {
- case 1: return cmd < __BTRFS_SEND_C_MAX_V1;
- case 2: return cmd < __BTRFS_SEND_C_MAX_V2;
+ case 1: return cmd <= BTRFS_SEND_C_MAX_V1;
+ case 2: return cmd <= BTRFS_SEND_C_MAX_V2;
default: return false;
}
}