From owner-svn-src-head@FreeBSD.ORG Thu Jun 16 11:57:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 770F8106566C; Thu, 16 Jun 2011 11:57:29 +0000 (UTC) (envelope-from avatar@mmlab.cse.yzu.edu.tw) Received: from www.mmlab.cse.yzu.edu.tw (www.mmlab.cse.yzu.edu.tw [140.138.150.166]) by mx1.freebsd.org (Postfix) with ESMTP id D61A18FC27; Thu, 16 Jun 2011 11:57:28 +0000 (UTC) Received: by www.mmlab.cse.yzu.edu.tw (qmail, from userid 1000) id F14E52EC686B; Thu, 16 Jun 2011 19:57:27 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mmlab.cse.yzu.edu.tw; s=test; t=1308225448; bh=xOQP7v/8pMku6Zpok4C492cQvgxdyH2mupO3/OGUTXI=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=hboVk6+YhzgAL47FNtu/jXE/VqlSJsp0B5QOQV9eaL3Y34C5/5Ih3i8gv3NBjbPkc pEyPf6McoheaUHJZf/5z3AdenibOz9On4JZBJ8HuRCNvcKXZtAftfowZr16bERifJA Wlm76J4M8SYjp0yYRICGU/QYEsehvhPdZ6+/iBj0= Received: from localhost (localhost [127.0.0.1]) by www.mmlab.cse.yzu.edu.tw (qmail) with ESMTP id F0C932EC6866; Thu, 16 Jun 2011 19:57:27 +0800 (CST) Date: Thu, 16 Jun 2011 19:57:27 +0800 (CST) From: Tai-hwa Liang To: Bruce Evans In-Reply-To: <20110616180803.D1005@besplex.bde.org> Message-ID: <11061619555315.44181@www.mmlab.cse.yzu.edu.tw> References: <201106160714.p5G7Etfx017112@svn.freebsd.org> <20110616180803.D1005@besplex.bde.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="3425325993-407207228-1308225447=:44181" Cc: Garrett Cooper , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r223139 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2011 11:57:29 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3425325993-407207228-1308225447=:44181 Content-Type: TEXT/PLAIN; charset=big5; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 16 Jun 2011, Bruce Evans wrote: > On Thu, 16 Jun 2011, Garrett Cooper wrote: > >> On Thu, Jun 16, 2011 at 12:19 AM, Garrett Cooper >> wrote: >>> On Thu, Jun 16, 2011 at 12:14 AM, Tai-hwa Liang >>> wrote: >>>> Author: avatar >>>> Date: Thu Jun 16 07:14:55 2011 >>>> New Revision: 223139 >>>> URL: http://svn.freebsd.org/changeset/base/223139 >>>> >>>> Log: >>>>  Unbreaking build on sparc64. > > Why not fix it on all arches? This seems to break it on all 32-bit arches. > >>>>  Submitted by: Garrett Cooper >>>> >>>> Modified: >>>>  head/lib/libstand/zalloc.c >>>> >>>> Modified: head/lib/libstand/zalloc.c >>>> ============================================================================== >>>> --- head/lib/libstand/zalloc.c  Thu Jun 16 05:26:03 2011        (r223138) >>>> +++ head/lib/libstand/zalloc.c  Thu Jun 16 07:14:55 2011        (r223139) >>>> @@ -154,7 +154,7 @@ zfree(MemPool *mp, void *ptr, iaddr_t by >>>>     if ((char *)ptr < (char *)mp->mp_Base || >>>>        (char *)ptr + bytes > (char *)mp->mp_End || >>>>        ((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0) >>>> -       panic("zfree(%p,%d): wild pointer", ptr, bytes); >>>> +       panic("zfree(%p,%ju): wild pointer", ptr, bytes); >>> >>> All of those need to be cast to (uintmax_t). Sorry :(.. > > Indeed. There is no format letter for intptr_t, and perhaps iaddr_t is > supposed to be opaque anyway. > >> And you need to add #include to stand.h in order to get >> uintmax_t. Here's a proper patch for amd64.. > > This would add namespace pollution. stand.h doesn't use anything in > . It depends on normal namespace pollution in an XXX section > in for the declaration of uintptr_t. It and other headers > should use __uintptr_t instead. Strangely, declares > uintptr_t but not uintmax_t. What about casting to __uintmax_t instead? Index: zalloc.c =================================================================== --- zalloc.c (revision 223146) +++ zalloc.c (working copy) @@ -154,7 +154,7 @@ if ((char *)ptr < (char *)mp->mp_Base || (char *)ptr + bytes > (char *)mp->mp_End || ((iaddr_t)ptr & MEMNODE_SIZE_MASK) != 0) - panic("zfree(%p,%ju): wild pointer", ptr, bytes); + panic("zfree(%p,%ju): wild pointer", ptr, (__uintmax_t)bytes); /* * free the segment @@ -177,8 +177,10 @@ /* * range check */ - if ((char *)ptr + bytes > (char *)mn) - panic("zfree(%p,%ju): corrupt memlist1",ptr, bytes); + if ((char *)ptr + bytes > (char *)mn) { + panic("zfree(%p,%ju): corrupt memlist1", ptr, + (__uintmax_t)bytes); + } /* * merge against next area or create independant area @@ -208,8 +210,10 @@ return; /* NOT REACHED */ } - if ((char *)ptr < (char *)mn + mn->mr_Bytes) - panic("zfree(%p,%ju): corrupt memlist2", ptr, bytes); + if ((char *)ptr < (char *)mn + mn->mr_Bytes) { + panic("zfree(%p,%ju): corrupt memlist2", ptr, + (__uintmax_t)bytes); + } } /* * We are beyond the last MemNode, append new MemNode. Merge against --3425325993-407207228-1308225447=:44181--