ACPI / tables: Check if id is NULL in acpi_table_parse()
authortangchen <tangchen@cn.fujitsu.com>
Mon, 6 Jan 2014 08:43:54 +0000 (16:43 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 6 Jan 2014 11:33:05 +0000 (12:33 +0100)
strncmp() does not check if the params are NULL. In acpi_table_parse(),
if @id is NULL, the kernel will panic.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/tables.c

index 4ec44258e4ff017bb7ed45a6fa213e49c29f8317..a17619bfb57b5298c1fd196a8ad3512a049ac0d2 100644 (file)
@@ -293,7 +293,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
        if (acpi_disabled)
                return -ENODEV;
 
-       if (!handler)
+       if (!id || !handler)
                return -EINVAL;
 
        if (strncmp(id, ACPI_SIG_MADT, 4) == 0)