From: kstailey Date: Mon, 10 Mar 1997 03:20:30 +0000 (+0000) Subject: Do not increase buffer bp->b_bcount in get_buffer_status(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c18b3bb806d70a05f060898885df205ff6e4d115;p=openbsd Do not increase buffer bp->b_bcount in get_buffer_status(). --- diff --git a/sys/scsi/ss.c b/sys/scsi/ss.c index b4fb0ba9623..323b5bc3aa0 100644 --- a/sys/scsi/ss.c +++ b/sys/scsi/ss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ss.c,v 1.22 1997/03/10 02:34:42 kstailey Exp $ */ +/* $OpenBSD: ss.c,v 1.23 1997/03/10 03:20:30 kstailey Exp $ */ /* $NetBSD: ss.c,v 1.10 1996/05/05 19:52:55 christos Exp $ */ /* @@ -31,7 +31,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include @@ -55,6 +54,8 @@ #define SSMODE(z) ( minor(z) & 0x03) #define SSUNIT(z) ((minor(z) >> 4) ) +#define MIN(a,b) (((a)<(b))?(a):(b)) + /* * If the mode is 3 (e.g. minor = 3,7,11,15) * then the device has been openned to set defaults @@ -628,7 +629,7 @@ ssioctl(dev, cmd, addr, flag, p) if (error) return (error); } else { - /* add routine to validate paramters */ + /* XXX add routine to validate paramters */ ss_set_window(ss, sio); } break; @@ -917,5 +918,5 @@ get_buffer_status(ss, bp) 0, 100000, bp, flags | SCSI_NOSLEEP)) { printf("%s: not queued\n", ss->sc_dev.dv_xname); } - bp->b_bcount = _3btol(buf_sz_retn.tgt_send_buf_len); + bp->b_bcount = MIN(_3btol(buf_sz_retn.tgt_send_buf_len), bp->b_bcount); }