Date: Sun, 16 Aug 2009 01:48:46 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196269 - head/sys/cddl/contrib/opensolaris/common/nvpair Message-ID: <200908160148.n7G1mkmE096710@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908160148.n7G1mkmE096710>