Skip to contentSkip to conversation

PnPBIOS bugfix (last of the first round of cleanups)

PATCH New Thomas Hood 1 participant 1 message Oct 9, 2001 Pnp support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PnPBIOS bugfix (last of the first round of cleanups)

This patch is required so that we don't use memory that's been kfree'd. (Corrects my mistake.) Also this makes the regionid a bit more informative (as it appears in /proc/ioports).

--
Thomas

The patch:

drivers/pnp/pnp_bios.c +5 -5
@@ -686,17 +686,17 @@
 	 * We really shouldn't just reserve these regions, though, since
 	 * that prevents the device drivers from claiming them.
 	 */
-	regionid = pnp_bios_kmalloc(8, GFP_KERNEL);
+	regionid = pnp_bios_kmalloc(16, GFP_KERNEL);
 	if ( regionid == NULL )
 		return;
-	memcpy(regionid,pnpid,8);
+	sprintf(regionid, "PnPBIOS %s", pnpid);
 	res = request_region(io,len,regionid);
 	if ( res == NULL )
 		kfree( regionid );
 	printk(
-		"PnPBIOS: %s: 0x%x-0x%x %s\n",
-		regionid, io, io+len-1,
-		NULL != res ? "reserved" : "was already reserved"
+		"PnPBIOS: %s: 0x%x-0x%x %s reserved\n",
+		pnpid, io, io+len-1,
+		NULL != res ? "has been" : "was already"
 	);
 
 	return;