From: Andrew Cooper Subject: [PATCH for-4.6 3/8] tools/libxl: Make libxl__conversion_helper_abort() safe to use Date: Tue, 28 Jul 2015 22:44:38 +0100 Message-ID: <1438119883-8083-4-git-send-email-andrew.cooper3@citrix.com> References: <1438119883-8083-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: <1438119883-8083-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: Xen-devel Cc: Andrew Cooper , Ian Jackson , Ian Campbell , Wei Liu List-Id: xen-devel@lists.xenproject.org STATE_AO_GC(chs->ao) uses chs->ao before determining whether the helper is active. In the case that the helper has not been started, its ao will not have been set up. Signed-off-by: Andrew Cooper --- CC: Ian Campbell CC: Ian Jackson CC: Wei Liu IMO, this is better than the alternative of requiring that ao is unconditionally set up. It allows the other functions which explicitly shouldn't be used on a non-running helper to trip an assert() rather than limp further along. --- tools/libxl/libxl_convert_callout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_convert_callout.c b/tools/libxl/libxl_convert_callout.c index 65b4df9..55645ba 100644 --- a/tools/libxl/libxl_convert_callout.c +++ b/tools/libxl/libxl_convert_callout.c @@ -118,10 +118,10 @@ void libxl__conversion_helper_abort(libxl__egc *egc, libxl__conversion_helper_state *chs, int rc) { - STATE_AO_GC(chs->ao); assert(rc); if (libxl__conversion_helper_inuse(chs)) { + STATE_AO_GC(chs->ao); /* A non-inuse chs doesn't have an ao. */ if (!chs->rc) chs->rc = rc; -- 1.7.10.4