]> git.baikalelectronics.ru Git - kernel.git/commit
mm: memcontrol: use flex_array_size() helper in memcpy()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 13 Oct 2020 23:52:36 +0000 (16:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2020 01:38:30 +0000 (18:38 -0700)
commit1de60264c595ffafca1638dd91894d314157b772
treea6ea984e58348fa5e45ba533338929aa06115d59
parentc3da2b6290852280a531a319a0fc8d310b5d6e87
mm: memcontrol: 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.

Also, remove unnecessary braces.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Link: https://lkml.kernel.org/r/ddd60dae2d9aea1ccdd2be66634815c93696125e.1596214831.git.gustavoars@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c