diff options
author | dg <dg@FreeBSD.org> | 1999-03-11 18:50:39 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1999-03-11 18:50:39 +0000 |
commit | d81c143718bd2975ba94402384484b1bd79807fc (patch) | |
tree | 0f48cf95ed207aadab6296a1eb7600e355e51889 /sys/geom | |
parent | 2d2ba9f6b47182b2d48081144cc208dca019a94e (diff) | |
download | FreeBSD-src-d81c143718bd2975ba94402384484b1bd79807fc.zip FreeBSD-src-d81c143718bd2975ba94402384484b1bd79807fc.tar.gz |
Fixed variable overflow problem.
Obtained from: NetBSD via Mark J. Taylor <mtaylor@cybernet.com>
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_ccd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index c61f5d0..b18ca55 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1,4 +1,4 @@ -/* $Id: ccd.c,v 1.41 1999/02/18 21:11:53 ken Exp $ */ +/* $Id: ccd.c,v 1.42 1999/03/10 00:41:27 mjacob Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -841,6 +841,7 @@ ccdbuffer(cb, cs, bp, bn, addr, bcount) register struct ccdcinfo *ci, *ci2 = NULL; /* XXX */ register struct ccdbuf *cbp; register daddr_t cbn, cboff; + register off_t cbc; #ifdef DEBUG if (ccddebug & CCDB_IO) @@ -919,11 +920,10 @@ ccdbuffer(cb, cs, bp, bn, addr, bcount) LIST_INIT(&cbp->cb_buf.b_dep); cbp->cb_buf.b_resid = 0; if (cs->sc_ileave == 0) - cbp->cb_buf.b_bcount = dbtob(ci->ci_size - cbn); + cbc = dbtob((off_t)(ci->ci_size - cbn)); else - cbp->cb_buf.b_bcount = dbtob(cs->sc_ileave - cboff); - if (cbp->cb_buf.b_bcount > bcount) - cbp->cb_buf.b_bcount = bcount; + cbc = dbtob((off_t)(cs->sc_ileave - cboff)); + cbp->cb_buf.b_bcount = (cbc < bcount) ? cbc : bcount; cbp->cb_buf.b_bufsize = cbp->cb_buf.b_bcount; |