Commit 5cc4a0f6 authored by Dan Carpenter's avatar Dan Carpenter Committed by Len Brown

ACPI: silence kmemcheck false positive

This addresses:

We copy some strings into "event" but we leave the space after the NULL
terminators uninitialized.  Later in acpi_bus_receive_event() we copy
the whole struct to another buffer with memcpy().  If the new buffer is
stored on the stack, kmemcheck prints a warning about the unitialized
space after the NULL terminators.

It's true that the space is uninitialized, but it's harmless.  The
buffer is only used in acpi_system_read_event() and we don't read past
the NULL terminators.

This patch changes the kmalloc() to kzalloc() so that we initialize the
memory and silence the kmemcheck warning.
Reported-by: default avatarChristian Casteyde <>
Signed-off-by: default avatarDan Carpenter <>
Signed-off-by: default avatarLen Brown <>
parent b91ce4d1
......@@ -527,7 +527,7 @@ int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id,
if (!event_is_open)
return 0;
event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
event = kzalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
if (!event)
return -ENOMEM;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment