summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2013-08-14 18:22:06 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-19 20:51:03 +0200
commit13df7b9e400211c717284fb841c849ba034ed348 (patch)
treea990d3725c2951518f80d2b73b16723336d5d2f4 /src/util
parente61044d99ce1e68057fda236f04a731f1f3f299a (diff)
downloadsssd-13df7b9e400211c717284fb841c849ba034ed348.tar.gz
sssd-13df7b9e400211c717284fb841c849ba034ed348.tar.bz2
sssd-13df7b9e400211c717284fb841c849ba034ed348.zip
mmap_cache: Off by one error.
Removes off by one error when using macro MC_SIZE_TO_SLOTS and adds new macro MC_SLOT_WITHIN_BOUNDS.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/mmap_cache.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/util/mmap_cache.h b/src/util/mmap_cache.h
index 6c223df6..abf8cac4 100644
--- a/src/util/mmap_cache.h
+++ b/src/util/mmap_cache.h
@@ -67,6 +67,9 @@ typedef uint32_t rel_ptr_t;
#define MC_SLOT_TO_PTR(base, slot, type) \
(type *)((base) + ((slot) * MC_SLOT_SIZE))
+#define MC_SLOT_WITHIN_BOUNDS(slot, dt_size) \
+ ((slot) < ((dt_size) / MC_SLOT_SIZE))
+
#define MC_VALID_BARRIER(val) (((val) & 0xff000000) == 0xf0000000)
#define MC_CHECK_RECORD_LENGTH(mc_ctx, rec) \