From 7aa8c7d98caa904b2a938e2735225cc3be2ad30b Mon Sep 17 00:00:00 2001 From: cbiere Date: Wed, 1 Nov 2006 11:37:59 +0000 Subject: [PATCH] Pointing one element past an array is fine, pointing before it isn't. --- sys/kern/uipc_usrreq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index a045a7120f98..a7aaf43d4bb0 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.93 2006/09/03 21:15:29 christos Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.94 2006/11/01 11:37:59 cbiere Exp $ */ /*- * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc. @@ -103,7 +103,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.93 2006/09/03 21:15:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.94 2006/11/01 11:37:59 cbiere Exp $"); #include #include @@ -1012,16 +1012,16 @@ unp_internalize(struct mbuf *control, struct lwp *l) * reverse order so that if pointers are bigger than ints, the * int won't get until we're done. */ - fdp = (int *)CMSG_DATA(cm) + nfds - 1; - rp = files + nfds - 1; + fdp = (int *)CMSG_DATA(cm) + nfds; + rp = files + nfds; for (i = 0; i < nfds; i++) { - fp = fdescp->fd_ofiles[*fdp--]; + fp = fdescp->fd_ofiles[*--fdp]; simple_lock(&fp->f_slock); #ifdef DIAGNOSTIC if (fp->f_iflags & FIF_WANTCLOSE) panic("unp_internalize: file already closed"); #endif - *rp-- = fp; + *--rp = fp; fp->f_count++; fp->f_msgcount++; simple_unlock(&fp->f_slock);