svn commit: r196269 -
head/sys/cddl/contrib/opensolaris/common/nvpair
Marcel Moolenaar
marcel at FreeBSD.org
Sun Aug 16 01:48:46 UTC 2009
Author: marcel
Date: Sun Aug 16 01:48:46 2009
New Revision: 196269
URL: http://svn.freebsd.org/changeset/base/196269
Log:
Fix misalignment in nvpair_native_embedded() caused by the compiler
replacing the bzero(). See also revision 195627, which fixed the
misalignment in nvpair_native_embedded_array().
Approved by: re (kensmith)
Modified:
head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 01:43:08 2009 (r196268)
+++ head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 01:48:46 2009 (r196269)
@@ -2523,14 +2523,15 @@ nvpair_native_embedded(nvstream_t *nvs,
{
if (nvs->nvs_op == NVS_OP_ENCODE) {
nvs_native_t *native = (nvs_native_t *)nvs->nvs_private;
- nvlist_t *packed = (void *)
+ char *packed = (void *)
(native->n_curr - nvp->nvp_size + NVP_VALOFF(nvp));
/*
* Null out the pointer that is meaningless in the packed
* structure. The address may not be aligned, so we have
* to use bzero.
*/
- bzero(&packed->nvl_priv, sizeof (packed->nvl_priv));
+ bzero(packed + offsetof(nvlist_t, nvl_priv),
+ sizeof(((nvlist_t *)NULL)->nvl_priv));
}
return (nvs_embedded(nvs, EMBEDDED_NVL(nvp)));
More information about the svn-src-all
mailing list