acpi: replaced kmalloc+memcpy with kmemdup
PATCH 1/1 acpi: replaced kmalloc+memcpy with kmemdup
Signed-off-by Andrei Epure <[email protected]>
--- drivers/acpi/bus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/bus.c +2 -3
@@ -288,13 +288,12 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) } out_success: context->ret.length = out_obj->buffer.length; - context->ret.pointer =kmalloc (context->ret.length,GFP_KERNEL ); + context->ret.pointer =kmemdup (out_obj->buffer.pointer, + context->ret.length,GFP_KERNEL );if (!context->ret.pointer) { status =AE_NO_MEMORY ; goto out_kfree; } -memcpy (context->ret.pointer, out_obj->buffer.pointer, - context->ret.length); status =AE_OK ; out_kfree:
Signature · 1 line
1.7.9.5
Quoted 1 line · Andrei Epure
Signed-off-by Andrei Epure <[email protected]>
Added a changelog and applied to linux-pm.git/linux-next.
Thanks,
Rafael
Quoted 25 lines
--- drivers/acpi/bus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/acpi/bus.c +2
-3@@ -288,13 +288,12 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) } out_success: context->ret.length = out_obj->buffer.length; - context->ret.pointer =kmalloc (context->ret.length,GFP_KERNEL ); + context->ret.pointer =kmemdup (out_obj->buffer.pointer, + context->ret.length,GFP_KERNEL );if (!context->ret.pointer) { status =AE_NO_MEMORY ; goto out_kfree; } -memcpy (context->ret.pointer, out_obj->buffer.pointer, - context->ret.length); status =AE_OK ; out_kfree:
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.