Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2010 21:49:53 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Brian Somers <brian@Awfulhak.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar <marcel@FreeBSD.org>, Bruce Evans <brde@optusnet.com.au>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r212886 - head/sbin/growfs
Message-ID:  <20100921213906.D14718@besplex.bde.org>
In-Reply-To: <20100921030916.3ee375c6@dev.lan.Awfulhak.org>
References:  <201009200420.o8K4KtKn026514@svn.freebsd.org> <20100920163758.A788@besplex.bde.org> <20100921030916.3ee375c6@dev.lan.Awfulhak.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 21 Sep 2010, Brian Somers wrote:

> On Mon, 20 Sep 2010 16:55:57 +1000 (EST) Bruce Evans <brde@optusnet.com.au> wrote:
>> On Mon, 20 Sep 2010, Marcel Moolenaar wrote:
>>
>>> Log:
>>>  Unbreak the build on strong-aligned architectures (arm, ia64).
>>>  Casting from (char *) to (struct ufs1_dinode *) changes the
>>>  alignment requirement of the pointer and GCC does not know that
>>>  the pointer is adequately aligned (due to malloc(3)), and warns
>>>  about it. Cast to (void *) first to by-pass the check.
>>
>> A previous version in which the pointer (iobuf) the correct type to
>> begin with was better.  It used to have type void *, but now has type
>> ...
>
> Maybe iobuf ought to go back to being a void * with casting where the
> arithmetic happens.  If it's changed, newfs/mkfs.c should probably change
> too.
>
> Is there some subtle difference that makes the casting ok in newfs/mkfs.c:
>
>    dp1 = (struct ufs1_dinode *)(&iobuf[start]);
>
> and not ok in growfs/growfs.c r212885:
>
>    dp1 = (struct ufs1_dinode *)iobuf;
>
> or is it just ignored because WARNS is 3 for newfs and is defaulted to 6 for growfs?

Just because of WARNS.

The `caddr_t iobuf;' in newfs is really old and should be fixed someday.  It
is the only caddr_t remaining in newfs.  In Lite2, newfs also uses caddr_t
for its now-dead mfs parts, including for its replacements for the malloc()
family which were errors in theory even at the time of Lite2 and which are
now errors in practice.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100921213906.D14718>