Date: Thu, 14 Jan 2016 21:33:43 +0000 From: Steven Hartland <steven.hartland@multiplay.co.uk> To: Steven Hartland <smh@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r294040 - head/sys/boot/zfs Message-ID: <56981437.2050301@multiplay.co.uk> In-Reply-To: <201601142131.u0ELVQ70054944@repo.freebsd.org> References: <201601142131.u0ELVQ70054944@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Fat fingers submitted before adding headers: MFC after: 2 weeks X-MFC-With: r293268 On 14/01/2016 21:31, Steven Hartland wrote: > Author: smh > Date: Thu Jan 14 21:31:26 2016 > New Revision: 294040 > URL: https://svnweb.freebsd.org/changeset/base/294040 > > Log: > Prevent bogus compiler in ZFS boot code > > Silence a bogus compiler warning about indexing past the end of dn_bonus. > > The ZFS code ensures this is not possible but the compiler can't determine > this so added an additional check to prevent this warning. > > Sponsored by: Multiplay > > Modified: > head/sys/boot/zfs/zfsimpl.c > > Modified: head/sys/boot/zfs/zfsimpl.c > ============================================================================== > --- head/sys/boot/zfs/zfsimpl.c Thu Jan 14 21:29:38 2016 (r294039) > +++ head/sys/boot/zfs/zfsimpl.c Thu Jan 14 21:31:26 2016 (r294040) > @@ -2165,7 +2165,13 @@ zfs_lookup(const struct zfsmount *mount, > strcpy(&path[sb.st_size], p); > else > path[sb.st_size] = 0; > - if (sb.st_size + sizeof(znode_phys_t) <= dn.dn_bonuslen) { > + /* > + * Second test is purely to silence bogus compiler > + * warning about accessing past the end of dn_bonus. > + */ > + if (sb.st_size + sizeof(znode_phys_t) <= > + dn.dn_bonuslen && sizeof(znode_phys_t) <= > + sizeof(dn.dn_bonus)) { > memcpy(path, &dn.dn_bonus[sizeof(znode_phys_t)], > sb.st_size); > } else { >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56981437.2050301>