From: Ian Jackson Subject: Re: [PATCH 2/3] libxl/remus: Move the assert before the info is used. Date: Tue, 26 Jan 2016 16:23:56 +0000 Message-ID: <22183.40348.100035.362423@mariner.uk.xensource.com> References: <1453756017-8747-1-git-send-email-konrad.wilk@oracle.com> <1453756017-8747-3-git-send-email-konrad.wilk@oracle.com> <1453825288.25257.32.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aO6PV-0003kU-TG for xen-devel@lists.xenproject.org; Tue, 26 Jan 2016 16:24:06 +0000 In-Reply-To: <1453825288.25257.32.camel@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: Ian Campbell Cc: xen-devel@lists.xenproject.org, Yang Hongyang , wei.liu2@citrix.com, Wen Congyang List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH 2/3] libxl/remus: Move the assert before the info is used."): > On Mon, 2016-01-25 at 16:06 -0500, Konrad Rzeszutek Wilk wrote: > > The assert(info) is after quite a lot of manipulations > > on 'info' - which makes the assert pointless because if > > info was NULL it would have crashed earlier. > > > > Move it earlier so that it guards before we try using > > the 'info' structure. > > That assert (wherever it is placed) is rather aggressive for an application > provided argument. ERROR_INVALID would be more normal I think. I think the assert should simply be removed. We don't assert() other pointer parameters for non-NULL-ness. Certainly turning null pointer bugs into ERROR_INVALID is very unfriendly. Ian.