sys/boot/zfs out of bounds warning

Sean Bruno sbruno at ignoranthack.me
Mon Apr 28 17:40:05 UTC 2014


looking at sys/boot things this morning, noted that there's a pretty
obvious warning about an out of bounds access.  I suspect that I don't
see a layer of abstraction here that makes this ok, but I'm not sure.

It seems like if this wasn't valid memory, things would go pretty badly 
in zfs_lookup().  Is there a better way to do this memcpy() such that it
doesn't trip a warning here?

-----------------
In file included from /home/sbruno/bsd/head/sys/boot/zfs/zfs.c:49:
/home/sbruno/bsd/head/sys/boot/zfs/zfsimpl.c:2080: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)],
                                              ^
~~~~~~~~~~~~~~~~~~~~
/home/sbruno/bsd/head/sys/boot/zfs/../../cddl/boot/zfs/zfsimpl.h:790:2:
note: array 'dn_bonus' declared here
        uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof (blkptr_t)];
------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20140428/24b8fc9d/attachment.sig>


More information about the freebsd-fs mailing list