summaryrefslogtreecommitdiffstats
path: root/src/util/mmap_cache.h
diff options
context:
space:
mode:
authorMichal Zidek <mzidek@redhat.com>2013-08-14 18:22:06 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-30 14:31:09 +0200
commit488f449bc57ca147432f8906d04ad111cd498b0d (patch)
treedc7cd8cb982cd3bf8c2820521c0082af3b0bf91e /src/util/mmap_cache.h
parent9460c08f23402850d942941200bc15a3fa530ef6 (diff)
downloadsssd-488f449bc57ca147432f8906d04ad111cd498b0d.tar.gz
sssd-488f449bc57ca147432f8906d04ad111cd498b0d.tar.xz
sssd-488f449bc57ca147432f8906d04ad111cd498b0d.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/mmap_cache.h')
-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 5350a0eb3..c04ce10df 100644
--- a/src/util/mmap_cache.h
+++ b/src/util/mmap_cache.h
@@ -68,6 +68,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 SSS_MC_MAJOR_VNO 0