diff options
author | Björn Töpel <bjorn.topel@intel.com> | 2019-10-29 16:43:07 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-10-31 21:41:33 +0100 |
commit | ff1c08e1f74b6864854c39be48aa799a6a2e4d2b (patch) | |
tree | 7d4474d2002747c76fcc5b312d60bbd59edd59f5 /lib | |
parent | 04ec044b7d30800296824783df7d9728d16d7567 (diff) |
bpf: Change size to u64 for bpf_map_{area_alloc, charge_init}()
The functions bpf_map_area_alloc() and bpf_map_charge_init() prior
this commit passed the size parameter as size_t. In this commit this
is changed to u64.
All users of these functions avoid size_t overflows on 32-bit systems,
by explicitly using u64 when calculating the allocation size and
memory charge cost. However, since the result was narrowed by the
size_t when passing size and cost to the functions, the overflow
handling was in vain.
Instead of changing all call sites to size_t and handle overflow at
the call site, the parameter is changed to u64 and checked in the
functions above.
Fixes: d407bd25a204 ("bpf: don't trigger OOM killer under pressure with map alloc")
Fixes: c85d69135a91 ("bpf: move memory size checks to bpf_map_charge_init()")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Link: https://lore.kernel.org/bpf/20191029154307.23053-1-bjorn.topel@gmail.com
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions