Skip to contentSkip to conversation

lib-stackdepotc-use-flex_array_size-helper-in-memcpy.patch removed from -mm tree

merged [email protected] 1 participant 1 message Dec 16, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: lib/stackdepot.c: use flex_array_size() helper in memcpy()
has been removed from the -mm tree. Its filename was
lib-stackdepotc-use-flex_array_size-helper-in-memcpy.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: "Gustavo A. R. Silva" <[email protected]>
Subject: lib/stackdepot.c: use flex_array_size() helper in memcpy()

Make use of the flex_array_size() helper to calculate the size of a flexible array member within an enclosing structure.

This helper offers defense-in-depth against potential integer overflows, while at the same time makes it explicitly clear that we are dealing with a flexible array member.

---

 lib/stackdepot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/stackdepot.c renamed from lib/stackdepot.c~lib-stackdepotc-use-flex_array_size-helper-in-memcpy +1 -1
@@ -135,7 +135,7 @@ static struct stack_record *depot_alloc_
 	stack->handle.slabindex = depot_index;
 	stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN;
 	stack->handle.valid = 1;
-	memcpy(stack->entries, entries, size * sizeof(unsigned long));
+	memcpy(stack->entries, entries, flex_array_size(stack, entries, size));
 	depot_offset += required_size;
 
 	return stack;

_

Patches currently in -mm which might be from [email protected] are