vring: Better error handling if num is too large

To be more consistent inside this function.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1410329871-28885-3-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Fam Zheng 2014-09-10 14:17:50 +08:00 committed by Stefan Hajnoczi
parent d9612b43dd
commit 032f8b8158

View File

@ -181,7 +181,8 @@ static int get_desc(Vring *vring, VirtQueueElement *elem,
/* Stop for now if there are not enough iovecs available. */
if (*num >= VIRTQUEUE_MAX_SIZE) {
return -ENOBUFS;
error_report("Invalid SG num: %u", *num);
return -EFAULT;
}
/* TODO handle non-contiguous memory across region boundaries */