Skip to content

Commit 5cc4a0f

Browse files
error27lenb
authored andcommitted
ACPI: silence kmemcheck false positive
This addresses: https://bugzilla.kernel.org/show_bug.cgi?id=14998 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: Christian Casteyde <casteyde.christian@free.fr> Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent b91ce4d commit 5cc4a0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id,
527527
if (!event_is_open)
528528
return 0;
529529

530-
event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
530+
event = kzalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
531531
if (!event)
532532
return -ENOMEM;
533533

0 commit comments

Comments
 (0)