From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUzQX-0001Nc-DC for qemu-devel@nongnu.org; Fri, 19 Sep 2014 10:44:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUzQQ-0007fH-MF for qemu-devel@nongnu.org; Fri, 19 Sep 2014 10:44:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUzQQ-0007eC-EN for qemu-devel@nongnu.org; Fri, 19 Sep 2014 10:44:42 -0400 From: Stefan Hajnoczi Date: Fri, 19 Sep 2014 15:42:17 +0100 Message-Id: <1411137738-31280-59-git-send-email-stefanha@redhat.com> In-Reply-To: <1411137738-31280-1-git-send-email-stefanha@redhat.com> References: <1411137738-31280-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 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 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 --- 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