Fix a possible out of bounds write in __bch2_btree_node_write when
the data buffer padding is cleared up to the block size. The out of
bounds write is possible if the data buffers size is not a multiple
of the block size.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
        /* bch2_varint_decode may read up to 7 bytes past the end of the buffer: */
        bytes += 8;
 
+       /* buffer must be a multiple of the block size */
+       bytes = round_up(bytes, block_bytes(c));
+
        data = btree_bounce_alloc(c, bytes, &used_mempool);
 
        if (!b->written) {