Index: src/libs/compat/freebsd_network/if.c
===================================================================
--- src/libs/compat/freebsd_network/if.c	(revision 28658)
+++ src/libs/compat/freebsd_network/if.c	(working copy)
@@ -101,6 +101,7 @@
 	driver_printf("%s: /dev/%s\n", gDriverName, ifp->device_name);
 
 	gDeviceNameList[ifp->if_index] = ifp->device_name;
+	ktrace_printf("if_initname: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	gDevices[ifp->if_index] = ifp;
 
 	ifp->root_device = find_root_device(unit);
@@ -309,6 +310,7 @@
 void
 ether_ifattach(struct ifnet *ifp, const uint8_t *macAddress)
 {
+	ktrace_printf("ether_ifattach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	ifp->if_addrlen = ETHER_ADDR_LEN;
 	ifp->if_hdrlen = ETHER_HDR_LEN;
 	if_attach(ifp);
@@ -324,6 +326,7 @@
 	//		once all drivers are cleaned up.
 	if (macAddress != IFP2ENADDR(ifp))
 		memcpy(IFP2ENADDR(ifp), macAddress, ETHER_ADDR_LEN);
+	ktrace_printf("ether_ifattach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 }
 
 
Index: src/libs/compat/freebsd_network/device.c
===================================================================
--- src/libs/compat/freebsd_network/device.c	(revision 28658)
+++ src/libs/compat/freebsd_network/device.c	(working copy)
@@ -33,6 +33,8 @@
 			break;
 	}
 
+	ktrace_printf("compat_open: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	if (gDeviceNameList[i] == NULL)
 		return B_ERROR;
 
Index: src/libs/compat/freebsd_network/compat/sys/haiku-module.h
===================================================================
--- src/libs/compat/freebsd_network/compat/sys/haiku-module.h	(revision 28658)
+++ src/libs/compat/freebsd_network/compat/sys/haiku-module.h	(working copy)
@@ -74,7 +74,7 @@
 	void uninit_driver()												\
 		{ _fbsd_uninit_driver(DRIVER_MODULE_NAME(name, busname)); }		\
 	const char **publish_devices()										\
-		{ return gDeviceNameList; }										\
+		{ ktrace_printf("publish_devices: gDeviceNameList[0]=%s\n", gDeviceNameList[0]); return gDeviceNameList; }										\
 	device_hooks *find_device(const char *name)							\
 		{ return &gDeviceHooks; }
 
Index: src/libs/compat/freebsd_network/fbsd_mii.c
===================================================================
--- src/libs/compat/freebsd_network/fbsd_mii.c	(revision 28658)
+++ src/libs/compat/freebsd_network/fbsd_mii.c	(working copy)
@@ -192,10 +192,13 @@
 {
 	struct mii_data		*mii;
 
+	ktrace_printf("miibus_detach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	bus_generic_detach(dev);
+	ktrace_printf("miibus_detach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	mii = device_get_softc(dev);
 	ifmedia_removeall(&mii->mii_media);
 	mii->mii_ifp = NULL;
+	ktrace_printf("miibus_detach: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	return(0);
 }
Index: src/libs/compat/freebsd_network/compat.c
===================================================================
--- src/libs/compat/freebsd_network/compat.c	(revision 28658)
+++ src/libs/compat/freebsd_network/compat.c	(working copy)
@@ -377,6 +377,8 @@
 	if (result == 0)
 		atomic_or(&device->flags, DEVICE_ATTACHED);
 
+	ktrace_printf("device_attach: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	return result;
 }
 
@@ -384,12 +386,15 @@
 int
 device_detach(device_t device)
 {
+	ktrace_printf("device_detach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	if (device->driver == NULL)
 		return B_ERROR;
+	ktrace_printf("device_detach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	if ((atomic_and(&device->flags, ~DEVICE_ATTACHED) & DEVICE_ATTACHED) != 0
 		&& device->methods.detach != NULL) {
 		int result = device->methods.detach(device);
+		ktrace_printf("device_detach: c: gDeviceNameList[0]=%s, result=0x%x\n", gDeviceNameList[0], result);
 		if (result != 0) {
 			atomic_or(&device->flags, DEVICE_ATTACHED);
 			return result;
@@ -404,6 +409,7 @@
 bus_generic_attach(device_t dev)
 {
 	device_t child = NULL;
+	ktrace_printf("bus_generic_attach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	while ((child = list_get_next_item(&dev->children, child)) != NULL) {
 		if (child->driver == NULL) {
@@ -418,12 +424,14 @@
 		} else
 			child->methods.probe(child);
 
+		ktrace_printf("bus_generic_attach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 		if (child->driver != NULL) {
 			int result = device_attach(child);
 			if (result != 0)
 				return result;
 		}
 	}
+	ktrace_printf("bus_generic_attach: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	return 0;
 }
@@ -433,17 +441,22 @@
 bus_generic_detach(device_t device)
 {
 	device_t child = NULL;
+	ktrace_printf("bus_generic_detach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	if ((device->flags & DEVICE_ATTACHED) == 0)
 		return B_ERROR;
 
+	ktrace_printf("bus_generic_detach: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	while (true) {
 		child = list_get_next_item(&device->children, child);
 		if (child == NULL)
 			break;
 
+		ktrace_printf("bus_generic_detach: d: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 		device_detach(child);
 	}
+	ktrace_printf("bus_generic_detach: e: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	return 0;
 }
Index: src/libs/compat/freebsd_network/driver.c
===================================================================
--- src/libs/compat/freebsd_network/driver.c	(revision 28658)
+++ src/libs/compat/freebsd_network/driver.c	(working copy)
@@ -58,6 +58,7 @@
 		device_delete_child(NULL, root);
 		return B_NO_MEMORY;
 	}
+	ktrace_printf("init_root_device: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	root->driver = &sRootDriver;
 	root->root = root;
@@ -95,14 +96,18 @@
 	pci_info *info;
 	int i;
 
+	ktrace_printf("_fbsd_init_hardware: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	if (get_module(B_PCI_MODULE_NAME, (module_info **)&gPci) < B_OK)
 		return B_ERROR;
+	ktrace_printf("_fbsd_init_hardware: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	if (init_root_device(driver, &root, &child) != B_OK) {
 		dprintf("%s: creating device failed.\n", gDriverName);
 		put_module(B_PCI_MODULE_NAME);
 		return B_ERROR;
 	}
+	ktrace_printf("_fbsd_init_hardware: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	TRACE(("%s: init_hardware(%p)\n", gDriverName, driver));
 
@@ -125,6 +130,7 @@
 			break;
 		}
 	}
+	ktrace_printf("_fbsd_init_hardware: d: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	if (status < B_OK)
 		TRACE(("%s: no hardware found.\n", gDriverName));
@@ -132,6 +138,8 @@
 	device_delete_child(NULL, root);
 	put_module(B_PCI_MODULE_NAME);
 
+	ktrace_printf("_fbsd_init_hardware: e: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	return status;
 }
 
@@ -142,6 +150,8 @@
 	status_t status;
 	int i = 0;
 
+	ktrace_printf("_fbsd_init_driver: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	dprintf("%s: init_driver(%p)\n", gDriverName, driver);
 
 	status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPci);
@@ -169,18 +179,23 @@
 		bool found = false;
 		pci_info *info;
 
+		ktrace_printf("_fbsd_init_driver: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 		status = init_root_device(driver, &root, &device);
+		ktrace_printf("_fbsd_init_driver: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 		if (status < B_OK)
 			break;
 
 		info = get_pci_info(root);
 
 		for (; gPci->get_nth_pci_info(i, info) == B_OK; i++) {
+			ktrace_printf("_fbsd_init_driver: ca: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 			if (device->methods.probe(device) < 0)
 				continue;
 
+			ktrace_printf("_fbsd_init_driver: d: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 			if (device_attach(device) == 0)
 				found = true;
+			ktrace_printf("_fbsd_init_driver: e: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 			i++;
 			break;
@@ -192,6 +207,7 @@
 		}
 	}
 
+	ktrace_printf("_fbsd_init_driver: f: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	if (gDeviceCount > 0)
 		return B_OK;
 
@@ -206,6 +222,7 @@
 	uninit_mutexes();
 err1:
 	put_module(B_PCI_MODULE_NAME);
+	ktrace_printf("_fbsd_init_driver: g: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	return status;
 }
 
Index: src/add-ons/kernel/drivers/network/3com/pci/if_xl.c
===================================================================
--- src/add-ons/kernel/drivers/network/3com/pci/if_xl.c	(revision 28658)
+++ src/add-ons/kernel/drivers/network/3com/pci/if_xl.c	(working copy)
@@ -144,6 +144,10 @@
 
 #include <pci/if_xlreg.h>
 
+//QQQ
+
+extern const char *gDeviceNameList[];
+
 /*
  * TX Checksumming is disabled by default for two reasons:
  * - TX Checksumming will occasionally produce corrupt packets
@@ -1054,6 +1058,8 @@
 {
 	struct xl_type		*t;
 
+	ktrace_printf("3com: xl_probe, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	t = xl_devs;
 
 	while (t->xl_name != NULL) {
@@ -1224,6 +1230,8 @@
 	int			unit, error = 0, rid, res;
 	uint16_t		did;
 
+	ktrace_printf("3com: xl_attach: a, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	sc = device_get_softc(dev);
 	sc->xl_dev = dev;
 	
@@ -1353,7 +1361,9 @@
 		goto fail;
 	}
 	ifp->if_softc = sc;
+	ktrace_printf("3com: xl_attach: b, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
+	ktrace_printf("3com: xl_attach: c, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	/* Reset the adapter. */
 	XL_LOCK(sc);
@@ -1363,11 +1373,13 @@
 	/*
 	 * Get station address from the EEPROM.
 	 */
+	ktrace_printf("3com: xl_attach: d, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	if (xl_read_eeprom(sc, (caddr_t)&eaddr, XL_EE_OEM_ADR0, 3, 1)) {
 		device_printf(dev, "failed to read station address\n");
 		error = ENXIO;
 		goto fail;
 	}
+	ktrace_printf("3com: xl_attach: e, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	sc->xl_unit = unit;
 	callout_init_mtx(&sc->xl_stat_callout, &sc->xl_mtx, 0);
@@ -1614,8 +1626,10 @@
 	}
 
 fail:
+	ktrace_printf("3com: xl_attach: f, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	if (error)
 		xl_detach(dev);
+	ktrace_printf("3com: xl_attach: g, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	return (error);
 }
@@ -1690,6 +1704,8 @@
 	sc = device_get_softc(dev);
 	ifp = sc->xl_ifp;
 
+	ktrace_printf("xl_detach: a, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
+
 	KASSERT(mtx_initialized(&sc->xl_mtx), ("xl mutex not initialized"));
 
 #ifdef DEVICE_POLLING
@@ -1730,8 +1746,10 @@
 	if (sc->xl_res)
 		bus_release_resource(dev, res, rid, sc->xl_res);
 
+	ktrace_printf("xl_detach: aa, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	if (ifp)
 		if_free(ifp);
+	ktrace_printf("xl_detach: ab, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 
 	if (sc->xl_mtag) {
 		bus_dmamap_destroy(sc->xl_mtag, sc->xl_tmpmap);
@@ -1754,6 +1772,7 @@
 
 	mtx_destroy(&sc->xl_mtx);
 
+	ktrace_printf("xl_detach: b, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
 	return (0);
 }
 
Index: src/system/kernel/device_manager/devfs.cpp
===================================================================
--- src/system/kernel/device_manager/devfs.cpp	(revision 28658)
+++ src/system/kernel/device_manager/devfs.cpp	(working copy)
@@ -215,6 +215,9 @@
 {
 	struct devfs_vnode* vnode;
 
+	if (name[0] < 0)
+		panic("devfs_create_vnode: name[0] < 0");
+
 	vnode = (struct devfs_vnode*)malloc(sizeof(struct devfs_vnode));
 	if (vnode == NULL)
 		return NULL;
Index: src/system/kernel/fs/vfs.cpp
===================================================================
--- src/system/kernel/fs/vfs.cpp	(revision 28658)
+++ src/system/kernel/fs/vfs.cpp	(working copy)
@@ -5470,9 +5470,10 @@
 			return B_BAD_ADDRESS;
 
 		ASSERT(entry->d_reclen >= sizeof(struct dirent));
+		ASSERT(entry->d_reclen <= sizeof(buffer));
 
 		if (user_memcpy(entry->d_name, userEntry->d_name,
-				entry->d_reclen - sizeof(struct dirent)) != B_OK)
+				entry->d_reclen - sizeof(struct dirent) + 1) != B_OK)
 			return B_BAD_ADDRESS;
 	} else
 		entry = userEntry;
