diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2013-04-29 19:21:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:43 -0400 |
commit | 70e3ba72ba9afd4ec28ab09f6a27aac00c30b358 (patch) | |
tree | 4141a47fc8157b0fc65f2756561ccda876a039dd /net/core/pktgen.c | |
parent | 33d7c5e539ba54f12b2628f7ef62ed1a7535956d (diff) |
net/core: remove duplicate statements by do-while loop
Remove duplicate statements by using do-while loop instead of while loop.
- A;
- while (e) {
+ do {
A;
- }
+ } while (e);
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r-- | net/core/pktgen.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 4582275a76fa..5c217427a669 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2396,18 +2396,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
2396 | __be32 s; | 2396 | __be32 s; |
2397 | if (pkt_dev->flags & F_IPDST_RND) { | 2397 | if (pkt_dev->flags & F_IPDST_RND) { |
2398 | 2398 | ||
2399 | t = prandom_u32() % (imx - imn) + imn; | 2399 | do { |
2400 | s = htonl(t); | ||
2401 | |||
2402 | while (ipv4_is_loopback(s) || | ||
2403 | ipv4_is_multicast(s) || | ||
2404 | ipv4_is_lbcast(s) || | ||
2405 | ipv4_is_zeronet(s) || | ||
2406 | ipv4_is_local_multicast(s)) { | ||
2407 | t = prandom_u32() % | 2400 | t = prandom_u32() % |
2408 | (imx - imn) + imn; | 2401 | (imx - imn) + imn; |
2409 | s = htonl(t); | 2402 | s = htonl(t); |
2410 | } | 2403 | } while (ipv4_is_loopback(s) || |
2404 | ipv4_is_multicast(s) || | ||
2405 | ipv4_is_lbcast(s) || | ||
2406 | ipv4_is_zeronet(s) || | ||
2407 | ipv4_is_local_multicast(s)); | ||
2411 | pkt_dev->cur_daddr = s; | 2408 | pkt_dev->cur_daddr = s; |
2412 | } else { | 2409 | } else { |
2413 | t = ntohl(pkt_dev->cur_daddr); | 2410 | t = ntohl(pkt_dev->cur_daddr); |