Page MenuHomeFreeBSD

D37293.id.diff
No OneTemporary

D37293.id.diff

diff --git a/usr.sbin/bhyve/config.c b/usr.sbin/bhyve/config.c
--- a/usr.sbin/bhyve/config.c
+++ b/usr.sbin/bhyve/config.c
@@ -65,7 +65,17 @@
break;
}
if (nvlist_exists_nvlist(nvl, name))
- nvl = (nvlist_t *)nvlist_get_nvlist(nvl, name);
+ /*
+ * XXX-MJ it is incorrect to cast away the const
+ * qualifier like this since the contract with nvlist
+ * says that values are immuatable, and some consumers
+ * will indeed add nodes to the returned nvlist. In
+ * practice, however, it appears to be harmless with the
+ * current nvlist implementation, so we just live with
+ * it until the implementation is reworked.
+ */
+ nvl = __DECONST(nvlist_t *,
+ nvlist_get_nvlist(nvl, name));
else if (nvlist_exists(nvl, name)) {
for (copy = tofree; copy < name; copy++)
if (*copy == '\0')
@@ -76,6 +86,10 @@
nvl = NULL;
break;
} else if (create) {
+ /*
+ * XXX-MJ as with the case above, "new_nvl" shouldn't be
+ * mutated after its ownership is given to "nvl".
+ */
new_nvl = nvlist_create(0);
if (new_nvl == NULL)
errx(4, "Failed to allocate memory");

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 19, 4:59 AM (5 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31747003
Default Alt Text
D37293.id.diff (1 KB)

Event Timeline