diff --git a/src/libs/compat/freebsd_network/compat.c b/src/libs/compat/freebsd_network/compat.c index 9603d92145..4fa97739f9 100644 --- a/src/libs/compat/freebsd_network/compat.c +++ b/src/libs/compat/freebsd_network/compat.c @@ -283,6 +283,7 @@ device_set_driver(device_t dev, driver_t *driver) if (dev->softc == NULL) return -1; + memset(dev->softc, 0, driver->softc_size); dev->driver = driver; for (i = 0; method == NULL && driver->methods[i].name != NULL; i++) { @@ -387,10 +388,9 @@ __haiku_probe_miibus(device_t dev, driver_t *drivers[], int count) void bus_generic_attach(device_t dev) { - device_t child; + device_t child = NULL; - for (child = list_get_first_item(&dev->children); - child; child = list_get_next_item(&dev->children, child)) { + for (; child != NULL; child = list_get_next_item(&dev->children, child)) { if (child->driver == NULL) { if (dev->driver == &miibus_driver) { driver_t *driver = __haiku_select_miibus_driver(child); diff --git a/src/libs/compat/freebsd_network/compat/sys/kernel.h b/src/libs/compat/freebsd_network/compat/sys/kernel.h index 88188edc67..6731994198 100644 --- a/src/libs/compat/freebsd_network/compat/sys/kernel.h +++ b/src/libs/compat/freebsd_network/compat/sys/kernel.h @@ -14,9 +14,9 @@ #define bootverbose 1 #define KASSERT(cond,msg) do { \ - if (!cond) \ + if (!(cond)) \ panic msg; \ -} while(0) +} while (0) typedef void (*system_init_func_t)(void *); diff --git a/src/libs/compat/freebsd_network/device.c b/src/libs/compat/freebsd_network/device.c index 1e6a012831..f0d4b5f640 100644 --- a/src/libs/compat/freebsd_network/device.c +++ b/src/libs/compat/freebsd_network/device.c @@ -11,11 +11,11 @@ #include "device.h" #include +#include + #include #include -#include - #include #include @@ -239,7 +239,7 @@ compat_write(void *cookie, off_t position, const void *buffer, device_printf(DEVNET(dev), "compat_write(%lld, %p, [%lu])\n", position, buffer, *numBytes); - mb = m_getcl(0, MT_DATA, 0); + mb = m_getcl(0, MT_DATA, M_PKTHDR); if (mb == NULL) return ENOBUFS;