Re: [PATCH v11 03/10] btrfs-progs: receive: support v2 send stream DATA tlv format

Nikolay Borisov
2021-10-20T14:36:04Z

On 1.09.21 г. 20:01, Omar Sandoval wrote:
> From: Boris Burkov <borisb@fb.com>
>
> The new format privileges the BTRFS_SEND_A_DATA attribute by
> guaranteeing it will always be the last attribute in any command that
> needs it, and by implicitly encoding the data length as the difference
> between the total command length in the command header and the sizes of
> the rest of the attributes (and of course the tlv_type identifying the
> DATA attribute). To parse the new stream, we must read the tlv_type and
> if it is not DATA, we proceed normally, but if it is DATA, we don't
> parse a tlv_len but simply compute the length.
>
> In addition, we add some bounds checking when parsing each chunk of
> data, as well as for the tlv_len itself.
>
> Signed-off-by: Boris Burkov <boris@bur.io>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>