From: "Jan Beulich" Subject: Re: [PATCH 3/4] common/page_alloc: Remove node id ASSERT()s Date: Tue, 24 Sep 2013 14:13:05 +0100 Message-ID: <5241AC0102000078000F5E35@nat28.tlf.novell.com> References: <1380024638-14983-1-git-send-email-andrew.cooper3@citrix.com> <1380024638-14983-4-git-send-email-andrew.cooper3@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 1VOSQ2-0005qm-2T for xen-devel@lists.xenproject.org; Tue, 24 Sep 2013 13:12:46 +0000 In-Reply-To: <1380024638-14983-4-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline 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: xen-devel , Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org >>> On 24.09.13 at 14:10, Andrew Cooper wrote: > Coverity ID 1055622, 1055630 > > node is an unsigned integer, so neccesserily >= 0. There does not appear to > be any purpose to these assertions in the first place. I think assertions should be treated more forgivingly than "normal" code: The check is very valid is the type of "node" got changed back to a signed int, as "node" is being used as array index. It is quite likely that on such type changes people would not remember to add back respective assertions. That said - I'm not really opposed to this change, I just think that assertions like the one here have documentation aspects going beyond mere correctness checking intentions. Jan > Signed-off-by: Andrew Cooper > CC: Keir Fraser > CC: Jan Beulich > CC: Tim Deegan > --- > xen/common/page_alloc.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c > index 41251b2..8cab81b 100644 > --- a/xen/common/page_alloc.c > +++ b/xen/common/page_alloc.c > @@ -585,7 +585,6 @@ static struct page_info *alloc_heap_pages( > } > first_node = node; > > - ASSERT(node >= 0); > ASSERT(zone_lo <= zone_hi); > ASSERT(zone_hi < NR_ZONES); > > @@ -812,7 +811,6 @@ static void free_heap_pages( > unsigned int zone = page_to_zone(pg); > > ASSERT(order <= MAX_ORDER); > - ASSERT(node >= 0); > > spin_lock(&heap_lock); > > -- > 1.7.10.4