From 3aa854409a2b50fcae9cce399826d82ed2588e82 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 30 Mar 2017 21:29:53 +0200 Subject: [PATCH] pbuf_copy_partial: remove double-check of 'buf' and 'dataptr' --- src/core/pbuf.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 635f2f35..b75747a7 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -1051,19 +1051,13 @@ u16_t pbuf_copy_partial(const struct pbuf *buf, void *dataptr, u16_t len, u16_t offset) { const struct pbuf *p; - u16_t left; + u16_t left = 0; u16_t buf_copy_len; u16_t copied_total = 0; LWIP_ERROR("pbuf_copy_partial: invalid buf", (buf != NULL), return 0;); LWIP_ERROR("pbuf_copy_partial: invalid dataptr", (dataptr != NULL), return 0;); - left = 0; - - if ((buf == NULL) || (dataptr == NULL)) { - return 0; - } - /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */ for (p = buf; len != 0 && p != NULL; p = p->next) { if ((offset != 0) && (offset >= p->len)) {