mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [merged] lib-stackdepotc-use-flex_array_size-helper-in-memcpy.patch removed from -mm tree
@ 2020-12-16 17:08 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-16 17:08 UTC (permalink / raw)
  To: gustavoars, mm-commits


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" <gustavoars@kernel.org>
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.

Link: https://lkml.kernel.org/r/186e37fe07196ee41a0e562fa8a8cb7a01112ec5.1601565471.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/stackdepot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/stackdepot.c~lib-stackdepotc-use-flex_array_size-helper-in-memcpy
+++ a/lib/stackdepot.c
@@ -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 gustavoars@kernel.org are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-16 17:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 17:08 [merged] lib-stackdepotc-use-flex_array_size-helper-in-memcpy.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).