Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309446
b: refs/heads/master
c: 76aa542
h: refs/heads/master
v: v3
  • Loading branch information
Xi Wang authored and Alex Elder committed May 14, 2012
1 parent d30ef4d commit 67d1814
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 065a68f9167e20f321a62d044cb2c3024393d455
refs/heads/master: 76aa542fb90e3e91edb1146d10ca7cf2cae8e7e9
9 changes: 7 additions & 2 deletions trunk/include/linux/ceph/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@ static inline void ceph_decode_copy(void **p, void *pv, size_t n)
/*
* bounds check input.
*/
static inline int ceph_has_room(void **p, void *end, size_t n)
{
return end >= *p && n <= end - *p;
}

#define ceph_decode_need(p, end, n, bad) \
do { \
if (unlikely(*(p) + (n) > (end))) \
if (!likely(ceph_has_room(p, end, n))) \
goto bad; \
} while (0)

Expand Down Expand Up @@ -166,7 +171,7 @@ static inline void ceph_encode_string(void **p, void *end,

#define ceph_encode_need(p, end, n, bad) \
do { \
if (unlikely(*(p) + (n) > (end))) \
if (!likely(ceph_has_room(p, end, n))) \
goto bad; \
} while (0)

Expand Down

0 comments on commit 67d1814

Please sign in to comment.