diff options
author | davidxu <davidxu@FreeBSD.org> | 2014-02-27 02:36:09 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2014-02-27 02:36:09 +0000 |
commit | 3c6681dc2c610038f536ad483a501e35a1a7312c (patch) | |
tree | 27c811097b1e1ebd1b76dac8f1a7de7be6e7aa26 /lib/libfetch/common.h | |
parent | 7f44971ec587a3cd596e85ca429d5242a154cb46 (diff) | |
download | FreeBSD-src-3c6681dc2c610038f536ad483a501e35a1a7312c.zip FreeBSD-src-3c6681dc2c610038f536ad483a501e35a1a7312c.tar.gz |
MFC r262277:
malloc_aligned() may not leave enough space for pointer to allocated memory,
saving the pointer will overwrite bytes belongs to another memory block
unexpectly, to fix the problem, use (allocated address + sizeof(void *)) as
initial value, and slip to next aligned address, so maximum extra bytes is
sizeof(void *) + align - 1.
Tested by: Andre Albsmeier < mail at ma17 dot ata dot myota dot orgndre >
MFC r262334:
Increase alignment to size of pointer if the alignment is too small.
Some modules do not align data at least to size of pointer, they uses a
smaller alignment, but our pointer should be aligned to its native
boundary, otherwise on some platforms, hardware alignment checking
will cause bus error.
Diffstat (limited to 'lib/libfetch/common.h')
0 files changed, 0 insertions, 0 deletions