From owner-freebsd-arch@FreeBSD.ORG Mon Feb 13 09:38:54 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC4AF16A420; Mon, 13 Feb 2006 09:38:54 +0000 (GMT) (envelope-from peterjeremy@optushome.com.au) Received: from mail18.syd.optusnet.com.au (mail18.syd.optusnet.com.au [211.29.132.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id 96DD143D46; Mon, 13 Feb 2006 09:38:53 +0000 (GMT) (envelope-from peterjeremy@optushome.com.au) Received: from turion.vk2pj.dyndns.org (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail18.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id k1D9cZ5G023458 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 13 Feb 2006 20:38:36 +1100 Received: from turion.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by turion.vk2pj.dyndns.org (8.13.4/8.13.4) with ESMTP id k1D9cZBf001396; Mon, 13 Feb 2006 20:38:35 +1100 (EST) (envelope-from peter@turion.vk2pj.dyndns.org) Received: (from peter@localhost) by turion.vk2pj.dyndns.org (8.13.4/8.13.4/Submit) id k1D9cY3n001395; Mon, 13 Feb 2006 20:38:34 +1100 (EST) (envelope-from peter) Date: Mon, 13 Feb 2006 20:38:34 +1100 From: Peter Jeremy To: Giorgos Keramidas Message-ID: <20060213093833.GB705@turion.vk2pj.dyndns.org> References: <20060205084813.GN21806@wombat.fafoe.narf.at> <867j89n71d.fsf@xps.des.no> <20060205220211.GA5151@falcon.midgard.homeip.net> <20060213.002310.125802352.imp@bsdimp.com> <20060213082129.GA13997@flame.pc> <43F04494.4030900@freebsd.org> <20060213084802.GA53779@flame.pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060213084802.GA53779@flame.pc> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.11 Cc: arch@freebsd.org, stefanf@freebsd.org, Colin Percival , des@des.no Subject: Re: [releng_6 tinderbox] failure on sparc64/sparc64 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2006 09:38:54 -0000 On Mon, 2006-Feb-13 10:48:02 +0200, Giorgos Keramidas wrote: >Good thinking. It's probably a good idea to avoid copying random >garbage, and using something like: > > struct foo foo; > uint32_t value[sizeof(uint32_t) * (sizeof(foo) / sizeof(uint32_t) + 1)]; That makes it about 4 times too large - you don't need to multiply by sizeof(uint32_t). >and then copying only sizeof(foo) bytes. And zeroing any remaining bytes to prevent uninitialised data leaking out of the kernel. >and won't allow overflowing of value[], but I don't really want to know >what it does on machines of varying endianess :-) No worse than trying to write (uint32_t *)&foo; BTW, the compiler is free to insert padding bytes into struct foo so it would need to be explicitly zeroed and then the required fields individually copied in. -- Peter Jeremy