Skip to content

Commit

Permalink
net/core: remove duplicate statements by do-while loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Apr 30, 2013
1 parent 33d7c5e commit 70e3ba7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2396,18 +2396,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__be32 s;
if (pkt_dev->flags & F_IPDST_RND) {

t = prandom_u32() % (imx - imn) + imn;
s = htonl(t);

while (ipv4_is_loopback(s) ||
ipv4_is_multicast(s) ||
ipv4_is_lbcast(s) ||
ipv4_is_zeronet(s) ||
ipv4_is_local_multicast(s)) {
do {
t = prandom_u32() %
(imx - imn) + imn;
s = htonl(t);
}
} while (ipv4_is_loopback(s) ||
ipv4_is_multicast(s) ||
ipv4_is_lbcast(s) ||
ipv4_is_zeronet(s) ||
ipv4_is_local_multicast(s));
pkt_dev->cur_daddr = s;
} else {
t = ntohl(pkt_dev->cur_daddr);
Expand Down

0 comments on commit 70e3ba7

Please sign in to comment.