static int nbd_parse_offset_hole_payload(NBDStructuredReplyChunk *chunk,

                                         uint8_t *payload, uint64_t orig_offset,

                                         QEMUIOVector *qiov, Error **errp)

{

    uint64_t offset;

    uint32_t hole_size;



    if (chunk->length != sizeof(offset) + sizeof(hole_size)) {

        error_setg(errp, "Protocol error: invalid payload for "

                         "NBD_REPLY_TYPE_OFFSET_HOLE");

        return -EINVAL;

    }



    offset = payload_advance64(&payload);

    hole_size = payload_advance32(&payload);



    if (offset < orig_offset || hole_size > qiov->size ||

        offset > orig_offset + qiov->size - hole_size) {

        error_setg(errp, "Protocol error: server sent chunk exceeding requested"

                         " region");

        return -EINVAL;

    }



    qemu_iovec_memset(qiov, offset - orig_offset, 0, hole_size);



    return 0;

}

static int nbd_parse_offset_hole_payload(NBDStructuredReplyChunk *chunk,

                                         uint8_t *payload, uint64_t orig_offset,

                                         QEMUIOVector *qiov, Error **errp)

{

    uint64_t offset;

    uint32_t hole_size;



    if (chunk->length != sizeof(offset) + sizeof(hole_size)) {

        error_setg(errp, "Protocol error: invalid payload for "

                         "NBD_REPLY_TYPE_OFFSET_HOLE");

        return -EINVAL;

    }



    offset = payload_advance64(&payload);

    hole_size = payload_advance32(&payload);



    if (offset < orig_offset || hole_size > qiov->size ||

        offset > orig_offset + qiov->size - hole_size) {

        error_setg(errp, "Protocol error: server sent chunk exceeding requested"

                         " region");

        return -EINVAL;

    }



    qemu_iovec_memset(qiov, offset - orig_offset, 0, hole_size);



    return 0;

}

    if (offset < orig_offset || hole_size > qiov->size ||
static int FUNC_0(NBDStructuredReplyChunk *VAR_0,

                                         uint8_t *VAR_1, uint64_t VAR_2,

                                         QEMUIOVector *VAR_3, Error **VAR_4)

{

    uint64_t offset;

    uint32_t hole_size;



    if (VAR_0->length != sizeof(offset) + sizeof(hole_size)) {

        error_setg(VAR_4, "Protocol error: invalid VAR_1 for "

                         "NBD_REPLY_TYPE_OFFSET_HOLE");

        return -EINVAL;

    }



    offset = payload_advance64(&VAR_1);

    hole_size = payload_advance32(&VAR_1);



    if (offset < VAR_2 || hole_size > VAR_3->size ||

        offset > VAR_2 + VAR_3->size - hole_size) {

        error_setg(VAR_4, "Protocol error: server sent VAR_0 exceeding requested"

                         " region");

        return -EINVAL;

    }



    qemu_iovec_memset(VAR_3, offset - VAR_2, 0, hole_size);



    return 0;

}

static int FUNC_0(NBDStructuredReplyChunk *VAR_0,
uint8_t *VAR_1, uint64_t VAR_2,
QEMUIOVector *VAR_3, Error **VAR_4)
{ uint64_t offset; uint32_t hole_size; if (VAR_0->length != sizeof(offset) + sizeof(hole_size)) { error_setg(VAR_4, "Protocol error: invalid VAR_1 for "
"NBD_REPLY_TYPE_OFFSET_HOLE"); return -EINVAL; } offset = payload_advance64(&VAR_1); hole_size = payload_advance32(&VAR_1); if (offset < VAR_2 || hole_size > VAR_3->size ||
offset > VAR_2 + VAR_3->size - hole_size) { error_setg(VAR_4, "Protocol error: server sent VAR_0 exceeding requested"
" region"); return -EINVAL; } qemu_iovec_memset(VAR_3, offset - VAR_2, 0, hole_size); return 0; }