svn commit: r207426 - head/sys/netgraph
Edward Tomasz Napierala
trasz at FreeBSD.org
Fri Apr 30 07:09:13 UTC 2010
Author: trasz
Date: Fri Apr 30 07:09:13 2010
New Revision: 207426
URL: http://svn.freebsd.org/changeset/base/207426
Log:
Avoid undefined behaviour.
Reviewed by: zec@
Modified:
head/sys/netgraph/ng_pipe.c
Modified: head/sys/netgraph/ng_pipe.c
==============================================================================
--- head/sys/netgraph/ng_pipe.c Fri Apr 30 06:43:35 2010 (r207425)
+++ head/sys/netgraph/ng_pipe.c Fri Apr 30 07:09:13 2010 (r207426)
@@ -816,14 +816,17 @@ pipe_dequeue(struct hookinfo *hinfo, str
}
/* Randomly discard the frame, according to BER setting */
- if (hinfo->cfg.ber &&
- ((oldrand = rand) ^ (rand = random())<<17) >=
- hinfo->ber_p[priv->overhead + m->m_pkthdr.len] ) {
- hinfo->stats.out_disc_frames++;
- hinfo->stats.out_disc_octets += m->m_pkthdr.len;
- uma_zfree(ngp_zone, ngp_h);
- m_freem(m);
- continue;
+ if (hinfo->cfg.ber) {
+ oldrand = rand;
+ rand = random();
+ if (((oldrand ^ rand) << 17) >=
+ hinfo->ber_p[priv->overhead + m->m_pkthdr.len]) {
+ hinfo->stats.out_disc_frames++;
+ hinfo->stats.out_disc_octets += m->m_pkthdr.len;
+ uma_zfree(ngp_zone, ngp_h);
+ m_freem(m);
+ continue;
+ }
}
/* Discard frame if outbound queue size limit exceeded */
More information about the svn-src-all
mailing list