From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW23A-0007x7-Nf for qemu-devel@nongnu.org; Mon, 22 Sep 2014 07:45:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XW234-0008Hh-17 for qemu-devel@nongnu.org; Mon, 22 Sep 2014 07:45:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW233-0008Ga-Qo for qemu-devel@nongnu.org; Mon, 22 Sep 2014 07:44:53 -0400 From: Stefan Hajnoczi Date: Mon, 22 Sep 2014 12:42:29 +0100 Message-Id: <1411386150-24003-59-git-send-email-stefanha@redhat.com> In-Reply-To: <1411386150-24003-1-git-send-email-stefanha@redhat.com> References: <1411386150-24003-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL v2 58/59] vring: Better error handling if num is too large List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Fam Zheng , Stefan Hajnoczi From: Fam Zheng To be more consistent inside this function. Signed-off-by: Fam Zheng Reviewed-by: Paolo Bonzini Message-id: 1410329871-28885-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi --- hw/virtio/dataplane/vring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 67cb2b8..372706a 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -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 */ -- 1.9.3