diff options
author | Sage Weil <sage@inktank.com> | 2013-09-04 21:29:11 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-04 21:29:11 -0700 |
commit | 849c2d25e981ca25f7e3bf6588b6b70ce255ebab (patch) | |
tree | 90e50193dc0767ae67c0f0d8f6577f43b9ffdaa5 /src/test/common/test_crc32c.cc | |
parent | 16b24f10a022a1aabdecf0af1bd428b23aa83229 (diff) | |
download | ceph-wip-intel-crc-workaround.tar.gz |
common/crc32c_intel_fast: avoid reading partial trailing wordwip-intel-crc-workaround
The optimized intel code reads in word-sized chunks, knowing that the
allocator will only hand out memory in word-sized increments. This makes
valgrind unhappy. Whitelisting doesn't work because for some reason there
is no caller context (probably because of some interaction with yasm?).
Instead, just use the baseline code for the last few bytes. This should
not be significant.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/test/common/test_crc32c.cc')
-rw-r--r-- | src/test/common/test_crc32c.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/common/test_crc32c.cc b/src/test/common/test_crc32c.cc index 19a1dfb7284..5cf88de0a80 100644 --- a/src/test/common/test_crc32c.cc +++ b/src/test/common/test_crc32c.cc @@ -23,6 +23,15 @@ TEST(Crc32c, Small) { ASSERT_EQ(3743019208u, ceph_crc32c(5678, (unsigned char *)b, strlen(b))); } +TEST(Crc32c, PartialWord) { + const char *a = (const char *)malloc(5); + const char *b = (const char *)malloc(35); + memset((void *)a, 1, 5); + memset((void *)b, 1, 35); + ASSERT_EQ(2715569182u, ceph_crc32c(0, (unsigned char *)a, 5)); + ASSERT_EQ(440531800u, ceph_crc32c(0, (unsigned char *)b, 35)); +} + TEST(Crc32c, Big) { int len = 4096000; char *a = (char *)malloc(len); |