[Linux-parport] [PATCH 3/3] device ID buffer size adjustment

Marko Kohtala marko.kohtala at kolumbus.fi
Wed Mar 30 15:16:17 EST 2005


The slab used for the allocation is anyway 1024 bytes, so allocate it all.
This is now safe with the fixes not to overflow the buffer.

Signed-off-by: Marko Kohtala <marko.kohtala at gmail.com>

diff -Nru a/drivers/parport/daisy.c b/drivers/parport/daisy.c
--- a/drivers/parport/daisy.c	2005-03-30 20:36:55 +03:00
+++ b/drivers/parport/daisy.c	2005-03-30 20:36:55 +03:00
@@ -144,9 +144,9 @@
  	add_dev (numdevs++, port, -1);

  	/* Find out the legacy device's IEEE 1284 device ID. */
-	deviceid = kmalloc (1000, GFP_KERNEL);
+	deviceid = kmalloc (1024, GFP_KERNEL);
  	if (deviceid) {
-		if (parport_device_id (numdevs - 1, deviceid, 1000) > 2)
+		if (parport_device_id (numdevs - 1, deviceid, 1024) > 2)
  			detected++;

  		kfree (deviceid);
@@ -501,11 +508,11 @@
  		 detected);

  	/* Ask the new devices to introduce themselves. */
-	deviceid = kmalloc (1000, GFP_KERNEL);
+	deviceid = kmalloc (1024, GFP_KERNEL);
  	if (!deviceid) return 0;

  	for (daisy = 0; thisdev < numdevs; thisdev++, daisy++)
-		parport_device_id (thisdev, deviceid, 1000);
+		parport_device_id (thisdev, deviceid, 1024);

  	kfree (deviceid);
  	return detected;




More information about the Linux-parport mailing list