linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 9/9] acpi: fix NULL bug for HID/UID string
@ 2009-08-06 22:57 akpm
  2009-08-06 23:18 ` Hugh Dickins
  0 siblings, 1 reply; 14+ messages in thread
From: akpm @ 2009-08-06 22:57 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, akpm, ming.m.lin, Valdis.Kletnieks, hugh.dickins

From: Lin Ming <ming.m.lin@intel.com>

acpi_device->pnp.hardware_id and unique_id are now allocated pointer. 
If it's NULL, return "\0" for acpi_device_hid and acpi_device_uid. 
Also, free hardware_id and unique_id when acpi_device is going to be
freed.

Cc: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/acpi/scan.c     |    4 ++++
 include/acpi/acpi_bus.h |    4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff -puN drivers/acpi/scan.c~acpi-fix-null-bug-for-hid-uid-string drivers/acpi/scan.c
--- a/drivers/acpi/scan.c~acpi-fix-null-bug-for-hid-uid-string
+++ a/drivers/acpi/scan.c
@@ -309,6 +309,8 @@ static void acpi_device_release(struct d
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
 	kfree(acpi_dev->pnp.cid_list);
+	kfree(acpi_dev->pnp.hardware_id);
+	kfree(acpi_dev->pnp.unique_id);
 	kfree(acpi_dev);
 }
 
@@ -1359,6 +1361,8 @@ end:
 		*child = device;
 	else {
 		kfree(device->pnp.cid_list);
+		kfree(device->pnp.hardware_id);
+		kfree(device->pnp.unique_id);
 		kfree(device);
 	}
 
diff -puN include/acpi/acpi_bus.h~acpi-fix-null-bug-for-hid-uid-string include/acpi/acpi_bus.h
--- a/include/acpi/acpi_bus.h~acpi-fix-null-bug-for-hid-uid-string
+++ a/include/acpi/acpi_bus.h
@@ -186,8 +186,8 @@ struct acpi_device_pnp {
 
 #define acpi_device_bid(d)	((d)->pnp.bus_id)
 #define acpi_device_adr(d)	((d)->pnp.bus_address)
-#define acpi_device_hid(d)	((d)->pnp.hardware_id)
-#define acpi_device_uid(d)	((d)->pnp.unique_id)
+#define acpi_device_hid(d)	((d)->pnp.hardware_id ? (d)->pnp.hardware_id : "\0")
+#define acpi_device_uid(d)	((d)->pnp.unique_id ? (d)->pnp.unique_id : "\0")
 #define acpi_device_name(d)	((d)->pnp.device_name)
 #define acpi_device_class(d)	((d)->pnp.device_class)
 
_

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-09-01  1:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-06 22:57 [patch 9/9] acpi: fix NULL bug for HID/UID string akpm
2009-08-06 23:18 ` Hugh Dickins
2009-08-13 15:55   ` Bjorn Helgaas
2009-08-13 16:46     ` Hugh Dickins
2009-08-14  1:28       ` Lin Ming
2009-08-14 16:44         ` Bjorn Helgaas
2009-08-14 18:18           ` Hugh Dickins
2009-08-14 20:08             ` Bjorn Helgaas
2009-08-14 20:36               ` Hugh Dickins
2009-08-14 19:53           ` Valdis.Kletnieks
2009-08-14 20:10             ` Bjorn Helgaas
2009-08-15 14:14               ` Bartlomiej Zolnierkiewicz
2009-08-17 17:44                 ` Bjorn Helgaas
2009-09-01  1:41   ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).