From: Ian Jackson Subject: Re: [PATCH] tools/libxl: Fix build following c/s c3c8da9 Date: Mon, 29 Jun 2015 15:09:44 +0100 Message-ID: <21905.20904.334921.585121@mariner.uk.xensource.com> References: <1435581680-11989-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1435581680-11989-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Wei Liu , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("[PATCH] tools/libxl: Fix build following c/s c3c8da9"): > c/s 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, which is cause by GCC 4.8's -Wmaybe-uninitialized The solution is not to initialise rc (to a bogus value) but to fix the goto out paths to explicitly set rc. Can you easily confirm that this fixes it ? Ian. diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index bdc0465..1c9418a 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; }