acpi:correctly check failed allocation
PATCH 1/1 acpi:correctly check failed allocation
Since kobject_create_and_add can be failed in memory pressure, return value need to be checked and return ENOMEM.
Signed-off-by Insu Yun <[email protected]>
--- drivers/acpi/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/sysfs.c +2 -0
@@ -878,6 +878,8 @@ int __init acpi_sysfs_init(void)return result; hotplug_kobj =kobject_create_and_add ("hotplug" , acpi_kobj); +if (!hotplug_kobj) +return -ENOMEM ; result =sysfs_create_file (hotplug_kobj, &force_remove_attr.attr);if (result)return result;
Signature · 1 line
1.9.1
Quoted 14 lines · Insu Yun
Since
kobject_create_and_addcan be failed in memory pressure, return value need to be checked and return ENOMEM.Signed-off-by Insu Yun <[email protected]>--- drivers/acpi/sysfs.c | 2 ++ 1 file changed, 2 insertions(+)drivers/acpi/sysfs.c +0
-0
drivers/acpi/sysfs.c int __init acpi_sysfs_init(void) · line 885
Quoted 8 lines
drivers/acpi/sysfs.c +2
-0@@ -878,6 +878,8 @@ int __init acpi_sysfs_init(void)return result; hotplug_kobj =kobject_create_and_add ("hotplug" , acpi_kobj); +if (!hotplug_kobj) +return -ENOMEM ; result =sysfs_create_file (hotplug_kobj, &force_remove_attr.attr);if (result)return result;
Applied (with whitespace fixed), thanks!
Rafael