From b475bfd8f0e138dbeea76ec9232b7d1d39af92af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20G=C3=BCndo=C4=9Fan?= Date: Fri, 31 Jul 2015 18:25:12 +0200 Subject: [PATCH] ng_pktbuf_static: enhance _pktbuf_contains --- sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c b/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c index 6c520b622b..452384fad9 100644 --- a/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c +++ b/sys/net/crosslayer/ng_pktbuf_static/ng_pktbuf_static.c @@ -52,8 +52,7 @@ static void _pktbuf_free(void *data, size_t size); static inline bool _pktbuf_contains(void *ptr) { - return (&_pktbuf[0] <= (uint8_t *)ptr) && - ((uint8_t *)ptr <= &_pktbuf[NG_PKTBUF_SIZE - 1]); + return (unsigned)((uint8_t *)ptr - _pktbuf) < NG_PKTBUF_SIZE; } /* fits size to byte alignment */