]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
uknetdev_output: Fix loop iterator
authorFlorian Schmidt <florian.schmidt@neclab.eu>
Mon, 18 Feb 2019 09:30:26 +0000 (10:30 +0100)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Mon, 18 Feb 2019 14:38:57 +0000 (15:38 +0100)
Setting q to p->next leads to an infinite loop if p has at least two
segments. The correct way is to iterate over q so we actually progress
through the list.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
uknetdev.c

index 34394fc5531703bfb802d3259ac1eb9bc3b28d90..47d2fb19d7133b3e565735e49ff2019b13df8998 100644 (file)
@@ -142,7 +142,7 @@ static err_t uknetdev_output(struct netif *nf, struct pbuf *p)
         *       yet. As long as we do not have this, we have to copy.
         */
        wpos = nb->data;
-       for (q = p; q != NULL; q = p->next) {
+       for (q = p; q != NULL; q = q->next) {
                memcpy(wpos, q->payload, q->len);
                wpos += q->len;
        }