Unix Technical Forum

known zero subtraction in uipc_mbuf.c

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 ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 08:53 AM
tbert
 
Posts: n/a
Default known zero subtraction in uipc_mbuf.c

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;
}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com