Message ID | 20200921113420.154378-3-stefanha@redhat.com |
---|---|
State | New |
Headers | show |
Series | libvhost-user: return after vu_panic() | expand |
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 --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 */
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(+)