Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Dec 2012 16:37:23 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        Garrett Cooper <yanegomi@gmail.com>, Taku YAMAMOTO <taku@tackymt.homeip.net>, freebsd-current@FreeBSD.org
Subject:   Re: A suspicious warning in sys/boot/zfs/zfsimpl.c
Message-ID:  <50BB75B3.6070505@FreeBSD.org>
In-Reply-To: <50B9E47F.6070005@FreeBSD.org>
References:  <20120703102142.6554b10e.taku@tackymt.homeip.net> <CAGH67wQ3BtyaYZNGxT_UW%2Be=CVR0V6V%2BZc027bDgDNv6fK66eg@mail.gmail.com> <50B9E47F.6070005@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-12-01 12:05, Andriy Gapon wrote:
> on 01/12/2012 12:59 Garrett Cooper said the following:
>> On Mon, Jul 2, 2012 at 6:21 PM, Taku YAMAMOTO <taku@tackymt.homeip.net> wrote:
>>> When I built the world as of r237813, clang reported a warning which
>>> caught my attention.
>>>
>>> ===> sys/boot/zfs (all)
>>> clang  -O2 -pipe -march=pentium4 -DBOOTPROG=\"zfsloader\" -I/usr/src/sys/boot/zfs/../common -I/usr/src/sys/boot/zfs/../.. -I. -I/usr/src/sys/boot/zfs/../../../lib/libstand -I/usr/src/sys/boot/zfs/../../cddl/boot/zfs -ffreestanding -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -Wformat -Wall -DNDEBUG -std=gnu99 -Qunused-arguments  -c /usr/src/sys/boot/zfs/zfs.c -o zfs.o
>>> In file included from /usr/src/sys/boot/zfs/zfs.c:48:
>>> /usr/src/sys/boot/zfs/zfsimpl.c:2033:19: warning: array index 264 is past the end of the array (which contains 192 elements) [-Warray-bounds]
>>>                                  memcpy(path, &dn.dn_bonus[sizeof(znode_phys_t)],
>>>                                                ^           ~~~~~~~~~~~~~~~~~~~~
>>> /usr/src/sys/boot/zfs/../../cddl/boot/zfs/zfsimpl.h:788:2: note: array 'dn_bonus' declared here
>>>          uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof (blkptr_t)];
>>>          ^
>>>
>>> I don't have a zfs-powered machine, so I'm not sure whether this
>>> warning is false-positive or not.
>>
>>      I'm seeing the same warnings trying to build HEAD r242903 with
>> clang on amd64. Andriy CCed.
>
> I believe that there is no actual problem there.

Indeed.  The ZFS code seems to be using the dnode_phys_t::dn_bonus field
as a sort of flexible struct member.  These specific warnings can be
ignored, or turned off.



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