aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-10-09 04:59:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:48 -0400
commitcfcabdcc2d5a810208e5bb3974121b7ed60119aa (patch)
tree1aed711eeecc5a303b57f1fc47e1b5746e8a72c2 /net/core/pktgen.c
parentde83c058af25aa97ed4864abab11e90e8dead6e2 (diff)
[NET]: sparse warning fixes
Fix a bunch of sparse warnings. Mostly about 0 used as NULL pointer, and shadowed variable declarations. One notable case was that hash size should have been unsigned. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index f07bd590f8f9..2100c734b102 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1563,15 +1563,17 @@ static ssize_t pktgen_if_write(struct file *file,
1563 } 1563 }
1564 1564
1565 if (!strcmp(name, "mpls")) { 1565 if (!strcmp(name, "mpls")) {
1566 unsigned n, offset; 1566 unsigned n, cnt;
1567
1567 len = get_labels(&user_buffer[i], pkt_dev); 1568 len = get_labels(&user_buffer[i], pkt_dev);
1568 if (len < 0) { return len; } 1569 if (len < 0)
1570 return len;
1569 i += len; 1571 i += len;
1570 offset = sprintf(pg_result, "OK: mpls="); 1572 cnt = sprintf(pg_result, "OK: mpls=");
1571 for (n = 0; n < pkt_dev->nr_labels; n++) 1573 for (n = 0; n < pkt_dev->nr_labels; n++)
1572 offset += sprintf(pg_result + offset, 1574 cnt += sprintf(pg_result + cnt,
1573 "%08x%s", ntohl(pkt_dev->labels[n]), 1575 "%08x%s", ntohl(pkt_dev->labels[n]),
1574 n == pkt_dev->nr_labels-1 ? "" : ","); 1576 n == pkt_dev->nr_labels-1 ? "" : ",");
1575 1577
1576 if (pkt_dev->nr_labels && pkt_dev->vlan_id != 0xffff) { 1578 if (pkt_dev->nr_labels && pkt_dev->vlan_id != 0xffff) {
1577 pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */ 1579 pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
@@ -2731,6 +2733,7 @@ static unsigned int scan_ip6(const char *s, char ip[16])
2731 unsigned int prefixlen = 0; 2733 unsigned int prefixlen = 0;
2732 unsigned int suffixlen = 0; 2734 unsigned int suffixlen = 0;
2733 __be32 tmp; 2735 __be32 tmp;
2736 char *pos;
2734 2737
2735 for (i = 0; i < 16; i++) 2738 for (i = 0; i < 16; i++)
2736 ip[i] = 0; 2739 ip[i] = 0;
@@ -2745,12 +2748,9 @@ static unsigned int scan_ip6(const char *s, char ip[16])
2745 } 2748 }
2746 s++; 2749 s++;
2747 } 2750 }
2748 {
2749 char *tmp;
2750 u = simple_strtoul(s, &tmp, 16);
2751 i = tmp - s;
2752 }
2753 2751
2752 u = simple_strtoul(s, &pos, 16);
2753 i = pos - s;
2754 if (!i) 2754 if (!i)
2755 return 0; 2755 return 0;
2756 if (prefixlen == 12 && s[i] == '.') { 2756 if (prefixlen == 12 && s[i] == '.') {
@@ -2778,11 +2778,9 @@ static unsigned int scan_ip6(const char *s, char ip[16])
2778 len++; 2778 len++;
2779 } else if (suffixlen != 0) 2779 } else if (suffixlen != 0)
2780 break; 2780 break;
2781 { 2781
2782 char *tmp; 2782 u = simple_strtol(s, &pos, 16);
2783 u = simple_strtol(s, &tmp, 16); 2783 i = pos - s;
2784 i = tmp - s;
2785 }
2786 if (!i) { 2784 if (!i) {
2787 if (*s) 2785 if (*s)
2788 len--; 2786 len--;