From: Pan Nengyuan Date: Fri, 23 Oct 2020 06:12:18 +0000 (+0800) Subject: block/file-posix: fix a possible undefined behavior X-Git-Tag: v6.0.0-rc0~180^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cb8d0851f1c00daafd736757a22f4820ec081b68;p=users%2Fdwmw2%2Fqemu.git block/file-posix: fix a possible undefined behavior local_err is not initialized to NULL, it will cause a assert error as below: qemu/util/error.c:59: error_setv: Assertion `*errp == NULL' failed. Fixes: c6447510690 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Stefano Garzarella Reviewed-by: Kevin Wolf Reviewed-by: Li Qiang Signed-off-by: Chen Qun Message-Id: <20201023061218.2080844-8-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- diff --git a/block/file-posix.c b/block/file-posix.c index 83e2cc5530..9804681d5c 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2111,7 +2111,7 @@ static void raw_aio_attach_aio_context(BlockDriverState *bs, #endif #ifdef CONFIG_LINUX_IO_URING if (s->use_linux_io_uring) { - Error *local_err; + Error *local_err = NULL; if (!aio_setup_linux_io_uring(new_context, &local_err)) { error_reportf_err(local_err, "Unable to use linux io_uring, " "falling back to thread pool: ");