Revision 258dc7c9 hw/virtio.c

b/hw/virtio.c
681 681
    uint32_t features;
682 682
    uint32_t supported_features =
683 683
        vdev->binding->get_features(vdev->binding_opaque);
684
    uint16_t num_heads;
684 685

  
685 686
    if (vdev->binding->load_config) {
686 687
        ret = vdev->binding->load_config(vdev->binding_opaque, f);
......
713 714
        if (vdev->vq[i].pa) {
714 715
            virtqueue_init(&vdev->vq[i]);
715 716
        }
717
	num_heads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx;
718
	/* Check it isn't doing very strange things with descriptor numbers. */
719
	if (num_heads > vdev->vq[i].vring.num) {
720
		fprintf(stderr, "VQ %d size 0x%x Guest index 0x%x "
721
                        "inconsistent with Host index 0x%x: delta 0x%x\n",
722
			i, vdev->vq[i].vring.num,
723
                        vring_avail_idx(&vdev->vq[i]),
724
                        vdev->vq[i].last_avail_idx, num_heads);
725
		return -1;
726
	}
716 727
        if (vdev->binding->load_queue) {
717 728
            ret = vdev->binding->load_queue(vdev->binding_opaque, i, f);
718 729
            if (ret)

Also available in: Unified diff