From 6a40f5edcb85d0f2436d3e8483d2772e74f9282c Mon Sep 17 00:00:00 2001 From: jdolecek Date: Fri, 1 Nov 2002 21:34:30 +0000 Subject: [PATCH] pipe_read(): initialize ocnt before pipelock() call; it might have been used unitialized when the pipelock() call would fail bug found by Krister Walfridsson --- sys/kern/sys_pipe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 02eab112113b..1c56c1312e1d 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_pipe.c,v 1.27 2002/10/23 09:14:22 jdolecek Exp $ */ +/* $NetBSD: sys_pipe.c,v 1.28 2002/11/01 21:34:30 jdolecek Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.27 2002/10/23 09:14:22 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.28 2002/11/01 21:34:30 jdolecek Exp $"); #include #include @@ -612,12 +612,12 @@ pipe_read(fp, offset, uio, cred, flags) PIPE_LOCK(rpipe); ++rpipe->pipe_busy; + ocnt = rpipe->pipe_buffer.cnt; + error = pipelock(rpipe, 1); if (error) goto unlocked_error; - ocnt = rpipe->pipe_buffer.cnt; - while (uio->uio_resid) { /* * normal pipe buffer receive