From: Ian Jackson Subject: Re: [PATCH 1/4] tools/libxl: Avoid deliberate NULL pointer dereference Date: Mon, 25 Nov 2013 12:32:43 +0000 Message-ID: <21139.17259.183650.890802@mariner.uk.xensource.com> References: <1385377973-21401-1-git-send-email-andrew.cooper3@citrix.com> <1385377973-21401-2-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: <1385377973-21401-2-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: Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("[PATCH 1/4] tools/libxl: Avoid deliberate NULL pointer dereference"): > Coverity ID: 1055290 > > Calling LIBXL__LOG_ERRNO(ctx,) with a ctx pointer we have just failed to > allocate is going to end badly. Opencode a suitable use of xtl_log() instead. > > Signed-off-by: Andrew Cooper > CC: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson This patch is correct, although the usual approach in libxl would be to crash by calling libxl__alloc_failed. It would be possible to do this in libxl_ctx_init by allocating a dummy ctx on the stack. Ian.