Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152937746
D37293.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37293.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D37293: bhyve: Cast away const when fetching a config nvlist
Attached
Detach File
Event Timeline
Log In to Comment