Go to file
Anatoly Burakov 20d2159d46 malloc: fix end for bounded elements
In cases when alignment is bigger than boundary, we may incorrectly
calculate end of a bounded malloc element.

Consider this: suppose we are allocating a bounded malloc element
that should be of 128 bytes in size, bounded to 128 bytes and
aligned on a 256-byte boundary. Suppose our malloc element ends
at 0x140 - that is, 256 plus one cacheline.

So, right at the start, we are aligning our new_data_start to
include the required element size, and to be aligned on a specified
boundary - so new_data_start becomes 0. This fails the following
bounds check, because our element cannot go above 128 bytes from
the start, and we are at 320. So, we enter the bounds handling
branch.

While we're in there, we are aligning end_pt to our boundedness
requirement of 128 byte, and end up with 0x100 (since 256 is
128-byte aligned). We recalculate new_data_size and it stays at
0, however our end is at 0x100, which is beyond the 128 byte
boundary, and we report inability to reserve a bounded element
when we could have.

This patch adds an end_pt recalculation after new_data_start
adjustment - we already know that size <= bound, so we can do it
safely - and we then correctly report that we can, in fact, try
using this element for bounded malloc allocation.

Fixes: fafcc11985 ("mem: rework memzone to be allocated by malloc")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-01-12 15:50:13 +01:00
app fix typos 2018-01-11 18:26:46 +01:00
buildtools tools: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
config config: use SPDX tag for Cavium copyright files 2018-01-09 16:19:01 +01:00
devtools tools: use SPDX tag for Cavium copyright files 2018-01-09 16:19:01 +01:00
doc gro: support VxLAN GRO 2018-01-11 23:18:36 +01:00
drivers bus/fslmc: change EQCR stashing threshold to 1 2018-01-12 12:49:39 +01:00
examples flow_classify: remove table id parameter from API 2018-01-11 19:15:26 +01:00
lib malloc: fix end for bounded elements 2018-01-12 15:50:13 +01:00
license license: introduce SPDX identifiers 2018-01-04 22:41:38 +01:00
mk mk: use SPDX tag for Cavium copyright files 2018-01-09 16:19:01 +01:00
pkg version: 17.11.0 2017-11-15 19:00:28 +01:00
test service: add attribute for number of invocations 2018-01-12 12:49:40 +01:00
usertools tools: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
.gitattributes improve git diff 2016-11-13 15:25:12 +01:00
.gitignore devtools: add tags and cscope index generation 2017-04-30 12:57:04 +02:00
GNUmakefile license: use SPDX tag in root makefile 2018-01-04 22:41:38 +01:00
MAINTAINERS maintainers: claim maintainership of net-intel sub tree 2018-01-09 15:40:39 +01:00
Makefile license: use SPDX tag in root makefile 2018-01-04 22:41:38 +01:00
README license: introduce SPDX identifiers 2018-01-04 22:41:38 +01:00

DPDK is a set of libraries and drivers for fast packet processing.
It supports many processor architectures and both FreeBSD and Linux.

The DPDK uses the Open Source BSD-3-Clause license for the core libraries
and drivers. The kernel components are GPL-2.0 licensed.

Please check the doc directory for release notes,
API documentation, and sample application information.

For questions and usage discussions, subscribe to: users@dpdk.org
Report bugs and issues to the development mailing list: dev@dpdk.org