summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2000-06-13 05:05:00 +0000
committerJason Wright <jason@cvs.openbsd.org>2000-06-13 05:05:00 +0000
commitd64777741686106171c3d0c66cc9b2150a2b09e1 (patch)
tree8854e9bb7d2cfb39dd4580f560af493edeecdf70 /sys
parent464f895b71ebd7e349f86c2bc48b6b2391c9450f (diff)
use the source length to calculate the output length instead of relying on
the length in the descriptors (which is sometimes 0!).
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/hifn7751.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index ff725ebad0d..6880990fe43 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.40 2000/06/13 02:22:50 jason Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.41 2000/06/13 05:04:59 jason Exp $ */
/*
* Invertex AEON / Hi/fn 7751 driver
@@ -1361,6 +1361,7 @@ hifn_callback(sc, cmd, macbuf)
struct cryptop *crp = (struct cryptop *)cmd->private_data;
struct cryptodesc *crd;
struct mbuf *m;
+ int totlen;
if ((crp->crp_flags & CRYPTO_F_IMBUF) && (cmd->src_m != cmd->dst_m)) {
m_freem(cmd->src_m);
@@ -1368,16 +1369,15 @@ hifn_callback(sc, cmd, macbuf)
}
if ((m = cmd->dst_m) != NULL) {
- int totlen = cmd->src_l, len;
-
+ totlen = cmd->src_l;
+ hifnstats.hst_obytes += totlen;
while (m) {
- len = dma->dstr[dma->dstk].l & HIFN_D_LENGTH;
- if (len > totlen)
- len = totlen;
+ if (totlen < m->m_len) {
+ m->m_len = totlen;
+ totlen = 0;
+ }
else
- totlen -= len;
- m->m_len = len;
- hifnstats.hst_obytes += m->m_len;
+ totlen -= m->m_len;
m = m->m_next;
if (++dma->dstk == HIFN_D_DST_RSIZE)
dma->dstk = 0;