]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pktgen: bug fix in transmission headers with frags=0
authorDaniel Turull <daniel.turull@gmail.com>
Mon, 14 Mar 2011 20:47:40 +0000 (13:47 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2011 20:47:40 +0000 (13:47 -0700)
(bug introduced by commit 26ad787962ef84677a48c560
(pktgen: speedup fragmented skbs)

The headers of pktgen were incorrectly added in a pktgen packet
without frags (frags=0). There was an offset in the pktgen headers.

The cause was in reusing the pgh variable as a return variable in skb_put
when adding the payload to the skb.

Signed-off-by: Daniel Turull <daniel.turull@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
net/core/pktgen.c

index f0aec6c39ecdc0bf6a3794aa4b5aeb7e058ad05e..0c55eaa70e39568a7ee2e280675cd8c01cf547b6 100644 (file)
@@ -2620,8 +2620,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
        datalen -= sizeof(*pgh);
 
        if (pkt_dev->nfrags <= 0) {
-               pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
-               memset(pgh + 1, 0, datalen);
+               memset(skb_put(skb, datalen), 0, datalen);
        } else {
                int frags = pkt_dev->nfrags;
                int i, len;