From owner-freebsd-fs@FreeBSD.ORG Mon Apr 28 17:40:05 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 662D1187 for ; Mon, 28 Apr 2014 17:40:05 +0000 (UTC) Received: from mail.ignoranthack.me (ujvl.x.rootbsd.net [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4447A19D6 for ; Mon, 28 Apr 2014 17:40:05 +0000 (UTC) Received: from [10.73.160.242] (nat-dip7.cfw-a-gci.corp.yahoo.com [209.131.62.116]) (using SSLv3 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id E65861928E4 for ; Mon, 28 Apr 2014 17:40:03 +0000 (UTC) Subject: sys/boot/zfs out of bounds warning From: Sean Bruno To: FreeBSD FS Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-jZFGj/1IUJZOT3Ykd/EZ" Date: Mon, 28 Apr 2014 10:40:03 -0700 Message-ID: <1398706803.1089.3.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: sbruno@freebsd.org List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2014 17:40:05 -0000 --=-jZFGj/1IUJZOT3Ykd/EZ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=20 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)]; ------ --=-jZFGj/1IUJZOT3Ykd/EZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJTXpJpAAoJEBkJRdwI6BaHIugH+wdDO3ncstCGMZP9w30PBviF 2wYwFzE6yMzdrgVK0lY7tkTjl4Q4NUnW0G0poufPN88bgA8BHCbcn/UV5MncTown 85ex5wrb1m56bc7IYMHf8cafSy4imUNRtVn29eXn6Cul2qVlSBFq5uFMti6R8AfZ t/O63VKpRFdqiS7CdZF+sY432VIPKpmyGbLv5xta5olV4FySNSe2il1wkIX3Hq2f iTYXYmV3E0iWFt2yexkxd3Ur+g1uYhga9OKXzbBi11cZiofghvXdWspEOPq1/sj+ opVJRnPzjVIvVL7G7+iu2wEbhIH84kYef4L+6a23rofen81rKe7ZE+zENHPolNc= =M5mD -----END PGP SIGNATURE----- --=-jZFGj/1IUJZOT3Ykd/EZ--