diff options
author | Michal Zidek <mzidek@redhat.com> | 2013-08-14 18:22:06 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-08-19 20:51:03 +0200 |
commit | 13df7b9e400211c717284fb841c849ba034ed348 (patch) | |
tree | a990d3725c2951518f80d2b73b16723336d5d2f4 /src/util | |
parent | e61044d99ce1e68057fda236f04a731f1f3f299a (diff) | |
download | sssd-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.h | 3 |
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) \ |