This is a discussion on known zero subtraction in uipc_mbuf.c within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Good evening - I sent a similar diff in a little while ago; it were, however, a rather ugly ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Good evening - I sent a similar diff in a little while ago; it were, however, a rather ugly thing... There's a subtraction of a known zero value in uipc_mbuf.c: The only way copyhdr evaluates to true is if the offset is 0; in the code as it is, it's saved as off0, and off is the manipulated value. There is then a subtraction of off0 in the first iteration of the loop if copyhdr is non-zero; this ends up as a subtraction of zero, and can be removed. - Bert Index: src/sys/kern/uipc_mbuf.c ================================================== ================= RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.76 diff -u -r1.76 uipc_mbuf.c --- src/sys/kern/uipc_mbuf.c 14 Jul 2006 01:58:58 -0000 1.76 +++ src/sys/kern/uipc_mbuf.c 4 Oct 2006 23:36:19 -0000 @@ -262,10 +262,9 @@ } struct mbuf * -m_copym0(struct mbuf *m, int off0, int len, int wait, int deep) +m_copym0(struct mbuf *m, int off, int len, int wait, int deep) { struct mbuf *n, **np; - int off = off0; struct mbuf *top; int copyhdr = 0; @@ -295,9 +294,7 @@ goto nospace; if (copyhdr) { M_DUP_PKTHDR(n, m); - if (len == M_COPYALL) - n->m_pkthdr.len -= off0; - else + if (len != M_COPYALL) n->m_pkthdr.len = len; copyhdr = 0; } |
| Thread Tools | |
| Display Modes | |
|
|