Skip to content

Commit

Permalink
ACPI: replace kmalloc+memcpy with kmemdup
Browse files Browse the repository at this point in the history
Replace the combination of kmalloc() and memcpy() in acpi_run_osc()
with a single call to kmemdup().

[rjw: Changelog]
Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Andrei Epure authored and Rafael J. Wysocki committed Mar 24, 2013
1 parent 82160dd commit e2cb5f0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e2cb5f0

Please sign in to comment.