From efb658a67c24944470e500cbf8fb18e88487225d Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 12 Mar 2019 14:34:19 +0100 Subject: [PATCH 1/2] gnrc_pktbuf_static: allow write-protect of size 0 snips Size 0 snips are legal packet snips (empty payload e.g.) so it doesn't make sense to issue an error in the write-protection in that case. API documentation doesn't mention it either and the tests still pass with the check removed. --- sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c b/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c index 86402bfdf0..0c9a43fb11 100644 --- a/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c +++ b/sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c @@ -249,7 +249,7 @@ void gnrc_pktbuf_release_error(gnrc_pktsnip_t *pkt, uint32_t err) gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt) { mutex_lock(&_mutex); - if ((pkt == NULL) || (pkt->size == 0)) { + if (pkt == NULL) { mutex_unlock(&_mutex); return NULL; } From 4f733840c6da61e79cb6eed7e48056375f2dcd2a Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 12 Mar 2019 14:34:33 +0100 Subject: [PATCH 2/2] gnrc_pktbuf_malloc: allow write-protect of size 0 snips Size 0 snips are legal packet snips (empty payload e.g.) so it doesn't make sense to issue an error in the write-protection in that case. API documentation doesn't mention it either and the tests still pass with the check removed. --- sys/net/gnrc/pktbuf_malloc/gnrc_pktbuf_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/pktbuf_malloc/gnrc_pktbuf_malloc.c b/sys/net/gnrc/pktbuf_malloc/gnrc_pktbuf_malloc.c index 55c0753017..de07bb7c96 100644 --- a/sys/net/gnrc/pktbuf_malloc/gnrc_pktbuf_malloc.c +++ b/sys/net/gnrc/pktbuf_malloc/gnrc_pktbuf_malloc.c @@ -232,7 +232,7 @@ void gnrc_pktbuf_release_error(gnrc_pktsnip_t *pkt, uint32_t err) gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt) { mutex_lock(&_mutex); - if ((pkt == NULL) || (pkt->size == 0)) { + if (pkt == NULL) { mutex_unlock(&_mutex); return NULL; }