Deleted Added
sdiff udiff text old ( 127911 ) new ( 130023 )
full compact
1/*
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_subr.c 130023 2004-06-03 01:47:37Z tjr $");
39
40#include "opt_zero.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/ktr.h>
46#include <sys/limits.h>

--- 88 unchanged lines hidden (view full) ---

135 int save = 0;
136
137 KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
138 ("uiomove: mode"));
139 KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread,
140 ("uiomove proc"));
141
142 if (td) {
143 save = td->td_pflags & TDP_DEADLKTREAT;
144 td->td_pflags |= TDP_DEADLKTREAT;
145 }
146
147 while (n > 0 && uio->uio_resid) {
148 iov = uio->uio_iov;
149 cnt = iov->iov_len;
150 if (cnt == 0) {
151 uio->uio_iov++;
152 uio->uio_iovcnt--;

--- 27 unchanged lines hidden (view full) ---

180 iov->iov_base = (char *)iov->iov_base + cnt;
181 iov->iov_len -= cnt;
182 uio->uio_resid -= cnt;
183 uio->uio_offset += cnt;
184 cp = (char *)cp + cnt;
185 n -= cnt;
186 }
187out:
188 if (td && save == 0)
189 td->td_pflags &= ~TDP_DEADLKTREAT;
190 return (error);
191}
192
193/*
194 * Wrapper for uiomove() that validates the arguments against a known-good
195 * kernel buffer. Currently, uiomove accepts a signed (n) argument, which
196 * is almost definitely a bad thing, so we catch that here as well. We
197 * return a runtime failure, but it might be desirable to generate a runtime

--- 318 unchanged lines hidden ---