From e2cb5f08469c991b187f66fa627d7673c7f3361b Mon Sep 17 00:00:00 2001 From: Andrei Epure Date: Mon, 11 Mar 2013 08:20:16 +0000 Subject: ACPI: replace kmalloc+memcpy with kmemdup Replace the combination of kmalloc() and memcpy() in acpi_run_osc() with a single call to kmemdup(). [rjw: Changelog] Signed-off-by: Andrei Epure Signed-off-by: Rafael J. Wysocki --- drivers/acpi/bus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 01708a16536..292de3cab9c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -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: -- cgit v1.2.3-70-g09d2