diff mbox series

[2/2] libvhost-user: return on error in vu_log_queue_fill()

Message ID 20200921113420.154378-3-stefanha@redhat.com
State New
Headers show
Series libvhost-user: return after vu_panic() | expand

Commit Message

Stefan Hajnoczi Sept. 21, 2020, 11:34 a.m. UTC
vu_panic() is not guaranteed to exit the program. Return early when
errors are encountered.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 contrib/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé Sept. 21, 2020, 2:25 p.m. UTC | #1
On 9/21/20 1:34 PM, Stefan Hajnoczi wrote:
> vu_panic() is not guaranteed to exit the program. Return early when

> errors are encountered.

> 

> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

> ---

>  contrib/libvhost-user/libvhost-user.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c

> index 27626e629a..1fc2cb12ce 100644

> --- a/contrib/libvhost-user/libvhost-user.c

> +++ b/contrib/libvhost-user/libvhost-user.c

> @@ -2722,6 +2722,7 @@ vu_log_queue_fill(VuDev *dev, VuVirtq *vq,

>      if (desc[i].flags & VRING_DESC_F_INDIRECT) {

>          if (desc[i].len % sizeof(struct vring_desc)) {

>              vu_panic(dev, "Invalid size for indirect buffer table");

> +            return;

>          }

>  

>          /* loop over the indirect descriptor table */

> 


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 27626e629a..1fc2cb12ce 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -2722,6 +2722,7 @@  vu_log_queue_fill(VuDev *dev, VuVirtq *vq,
     if (desc[i].flags & VRING_DESC_F_INDIRECT) {
         if (desc[i].len % sizeof(struct vring_desc)) {
             vu_panic(dev, "Invalid size for indirect buffer table");
+            return;
         }
 
         /* loop over the indirect descriptor table */