From e00ab5e0770ccd458211d6fe5b679e15f8d66bcf Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 29 Jun 2015 15:29:33 +0100 Subject: [PATCH] libxl: Fix uninitialised rc in libxl__domain_save_device_model c3c8da9 "libxl: ao: datacopier callback gets an rc" caused libxl__domain_save_device_model() to pass its rc directly into the callback. However in the preexisting code, there were 3 "goto out;" paths which left rc uninitialised. This causes a build failure with GCC 4.8's -Wmaybe-uninitialized. Set the rc explicitly on each goto out path. Reported-by: Andrew Cooper Signed-off-by: Ian Jackson Tested-by: Andrew Cooper --- tools/libxl/libxl_dom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index bdc04657fa..1c9418ab90 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -2190,17 +2190,20 @@ void libxl__domain_save_device_model(libxl__egc *egc, dc->readfd = open(filename, O_RDONLY); if (dc->readfd < 0) { LOGE(ERROR, "unable to open %s", dc->readwhat); + rc = ERROR_FAIL; goto out; } if (fstat(dc->readfd, &st)) { LOGE(ERROR, "unable to fstat %s", dc->readwhat); + rc = ERROR_FAIL; goto out; } if (!S_ISREG(st.st_mode)) { LOG(ERROR, "%s is not a plain file!", dc->readwhat); + rc = ERROR_FAIL; goto out; } -- 2.39.5