From: Jagannathan Raman Date: Fri, 12 Feb 2021 11:16:07 +0000 (-0500) Subject: io: error_prepend() in qio_channel_readv_full_all() causes segfault X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c90e3512a4683345a8e7074961d8275ceaec578d;p=qemu.git io: error_prepend() in qio_channel_readv_full_all() causes segfault Using error_prepend() in qio_channel_readv_full_all() causes a segfault as errp is not set when ret is 0. This results in the failure of iotest 83. Replacing with error_setg() fixes the problem. Additionally, removes a full stop at the end of error message Reported-by: Max Reitz Signed-off-by: Jagannathan Raman Fixes: bebab91ebdfc591f8793a9a17370df1bfbe8b2ca (io: add qio_channel_readv_full_all_eof & qio_channel_readv_full_all helpers) Message-Id: Reviewed-by: Daniel P. Berrangé Signed-off-by: Eric Blake --- diff --git a/io/channel.c b/io/channel.c index 4555021b62..e8b019dc36 100644 --- a/io/channel.c +++ b/io/channel.c @@ -202,8 +202,7 @@ int qio_channel_readv_full_all(QIOChannel *ioc, int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp); if (ret == 0) { - error_prepend(errp, - "Unexpected end-of-file before all data were read."); + error_setg(errp, "Unexpected end-of-file before all data were read"); return -1; } if (ret == 1) {