summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorsmh <smh@FreeBSD.org>2016-01-28 08:51:00 +0000
committersmh <smh@FreeBSD.org>2016-01-28 08:51:00 +0000
commitb455700ac9db72b9861bea120199a9d93eec71b5 (patch)
tree3e3836aed963f0f989fe8e9535b38438c1aeefc1 /sys/boot
parentc9b359acaab2bd3924abdc31463384b1d7779f40 (diff)
downloadFreeBSD-src-b455700ac9db72b9861bea120199a9d93eec71b5.zip
FreeBSD-src-b455700ac9db72b9861bea120199a9d93eec71b5.tar.gz
MFC r294040:
Prevent bogus compiler in ZFS boot code. Sponsored by: Multiplay
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/zfs/zfsimpl.c8
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 {
OpenPOWER on IntegriCloud