diff options
author | smh <smh@FreeBSD.org> | 2016-01-28 08:51:00 +0000 |
---|---|---|
committer | smh <smh@FreeBSD.org> | 2016-01-28 08:51:00 +0000 |
commit | b455700ac9db72b9861bea120199a9d93eec71b5 (patch) | |
tree | 3e3836aed963f0f989fe8e9535b38438c1aeefc1 /sys | |
parent | c9b359acaab2bd3924abdc31463384b1d7779f40 (diff) | |
download | FreeBSD-src-b455700ac9db72b9861bea120199a9d93eec71b5.zip FreeBSD-src-b455700ac9db72b9861bea120199a9d93eec71b5.tar.gz |
MFC r294040:
Prevent bogus compiler in ZFS boot code.
Sponsored by: Multiplay
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/zfs/zfsimpl.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/boot/zfs/zfsimpl.c b/sys/boot/zfs/zfsimpl.c index 927fbad..aa1a789 100644 --- a/sys/boot/zfs/zfsimpl.c +++ b/sys/boot/zfs/zfsimpl.c @@ -2165,7 +2165,13 @@ zfs_lookup(const struct zfsmount *mount, const char *upath, dnode_phys_t *dnode) 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 { |