diff options
-rw-r--r-- | net/core/pktgen.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 2c0df0f95b3d..679b797d06b1 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -771,10 +771,10 @@ done: | |||
771 | static unsigned long num_arg(const char __user * user_buffer, | 771 | static unsigned long num_arg(const char __user * user_buffer, |
772 | unsigned long maxlen, unsigned long *num) | 772 | unsigned long maxlen, unsigned long *num) |
773 | { | 773 | { |
774 | int i = 0; | 774 | int i; |
775 | *num = 0; | 775 | *num = 0; |
776 | 776 | ||
777 | for (; i < maxlen; i++) { | 777 | for (i = 0; i < maxlen; i++) { |
778 | char c; | 778 | char c; |
779 | if (get_user(c, &user_buffer[i])) | 779 | if (get_user(c, &user_buffer[i])) |
780 | return -EFAULT; | 780 | return -EFAULT; |
@@ -789,9 +789,9 @@ static unsigned long num_arg(const char __user * user_buffer, | |||
789 | 789 | ||
790 | static int strn_len(const char __user * user_buffer, unsigned int maxlen) | 790 | static int strn_len(const char __user * user_buffer, unsigned int maxlen) |
791 | { | 791 | { |
792 | int i = 0; | 792 | int i; |
793 | 793 | ||
794 | for (; i < maxlen; i++) { | 794 | for (i = 0; i < maxlen; i++) { |
795 | char c; | 795 | char c; |
796 | if (get_user(c, &user_buffer[i])) | 796 | if (get_user(c, &user_buffer[i])) |
797 | return -EFAULT; | 797 | return -EFAULT; |
@@ -846,7 +846,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
846 | { | 846 | { |
847 | struct seq_file *seq = file->private_data; | 847 | struct seq_file *seq = file->private_data; |
848 | struct pktgen_dev *pkt_dev = seq->private; | 848 | struct pktgen_dev *pkt_dev = seq->private; |
849 | int i = 0, max, len; | 849 | int i, max, len; |
850 | char name[16], valstr[32]; | 850 | char name[16], valstr[32]; |
851 | unsigned long value = 0; | 851 | unsigned long value = 0; |
852 | char *pg_result = NULL; | 852 | char *pg_result = NULL; |
@@ -860,13 +860,13 @@ static ssize_t pktgen_if_write(struct file *file, | |||
860 | return -EINVAL; | 860 | return -EINVAL; |
861 | } | 861 | } |
862 | 862 | ||
863 | max = count - i; | 863 | max = count; |
864 | tmp = count_trail_chars(&user_buffer[i], max); | 864 | tmp = count_trail_chars(user_buffer, max); |
865 | if (tmp < 0) { | 865 | if (tmp < 0) { |
866 | pr_warning("illegal format\n"); | 866 | pr_warning("illegal format\n"); |
867 | return tmp; | 867 | return tmp; |
868 | } | 868 | } |
869 | i += tmp; | 869 | i = tmp; |
870 | 870 | ||
871 | /* Read variable name */ | 871 | /* Read variable name */ |
872 | 872 | ||
@@ -1764,7 +1764,7 @@ static ssize_t pktgen_thread_write(struct file *file, | |||
1764 | { | 1764 | { |
1765 | struct seq_file *seq = file->private_data; | 1765 | struct seq_file *seq = file->private_data; |
1766 | struct pktgen_thread *t = seq->private; | 1766 | struct pktgen_thread *t = seq->private; |
1767 | int i = 0, max, len, ret; | 1767 | int i, max, len, ret; |
1768 | char name[40]; | 1768 | char name[40]; |
1769 | char *pg_result; | 1769 | char *pg_result; |
1770 | 1770 | ||
@@ -1773,12 +1773,12 @@ static ssize_t pktgen_thread_write(struct file *file, | |||
1773 | return -EINVAL; | 1773 | return -EINVAL; |
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | max = count - i; | 1776 | max = count; |
1777 | len = count_trail_chars(&user_buffer[i], max); | 1777 | len = count_trail_chars(user_buffer, max); |
1778 | if (len < 0) | 1778 | if (len < 0) |
1779 | return len; | 1779 | return len; |
1780 | 1780 | ||
1781 | i += len; | 1781 | i = len; |
1782 | 1782 | ||
1783 | /* Read variable name */ | 1783 | /* Read variable name */ |
1784 | 1784 | ||
@@ -1975,7 +1975,7 @@ static struct net_device *pktgen_dev_get_by_name(struct pktgen_dev *pkt_dev, | |||
1975 | const char *ifname) | 1975 | const char *ifname) |
1976 | { | 1976 | { |
1977 | char b[IFNAMSIZ+5]; | 1977 | char b[IFNAMSIZ+5]; |
1978 | int i = 0; | 1978 | int i; |
1979 | 1979 | ||
1980 | for (i = 0; ifname[i] != '@'; i++) { | 1980 | for (i = 0; ifname[i] != '@'; i++) { |
1981 | if (i == IFNAMSIZ) | 1981 | if (i == IFNAMSIZ) |
@@ -2519,8 +2519,8 @@ static void free_SAs(struct pktgen_dev *pkt_dev) | |||
2519 | { | 2519 | { |
2520 | if (pkt_dev->cflows) { | 2520 | if (pkt_dev->cflows) { |
2521 | /* let go of the SAs if we have them */ | 2521 | /* let go of the SAs if we have them */ |
2522 | int i = 0; | 2522 | int i; |
2523 | for (; i < pkt_dev->cflows; i++) { | 2523 | for (i = 0; i < pkt_dev->cflows; i++) { |
2524 | struct xfrm_state *x = pkt_dev->flows[i].x; | 2524 | struct xfrm_state *x = pkt_dev->flows[i].x; |
2525 | if (x) { | 2525 | if (x) { |
2526 | xfrm_state_put(x); | 2526 | xfrm_state_put(x); |