Commit e2cb5f08469c991b187f66fa627d7673c7f3361b

Authored by Andrei Epure
Committed by Rafael J. Wysocki
1 parent 82160dd8ba

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 <epure.andrei@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Showing 1 changed file with 2 additions and 3 deletions Side-by-side Diff

... ... @@ -288,13 +288,12 @@
288 288 }
289 289 out_success:
290 290 context->ret.length = out_obj->buffer.length;
291   - context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL);
  291 + context->ret.pointer = kmemdup(out_obj->buffer.pointer,
  292 + context->ret.length, GFP_KERNEL);
292 293 if (!context->ret.pointer) {
293 294 status = AE_NO_MEMORY;
294 295 goto out_kfree;
295 296 }
296   - memcpy(context->ret.pointer, out_obj->buffer.pointer,
297   - context->ret.length);
298 297 status = AE_OK;
299 298  
300 299 out_kfree: