Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Ops, initialise len before using it.



details:   https://anonhg.NetBSD.org/src/rev/379ed474cfc7
branches:  trunk
changeset: 542369:379ed474cfc7
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Jan 27 10:35:08 2003 +0000

description:
Ops, initialise len before using it.
Also, the minimum frame len is ETHER_MIN_LEN - ETHER_CRC_LEN.

diffstat:

 sys/dev/ic/i82586.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r 727024e940e2 -r 379ed474cfc7 sys/dev/ic/i82586.c
--- a/sys/dev/ic/i82586.c       Mon Jan 27 09:57:09 2003 +0000
+++ b/sys/dev/ic/i82586.c       Mon Jan 27 10:35:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82586.c,v 1.45 2003/01/15 21:54:02 bouyer Exp $       */
+/*     $NetBSD: i82586.c,v 1.46 2003/01/27 10:35:08 bouyer Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -144,12 +144,12 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.45 2003/01/15 21:54:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.46 2003/01/27 10:35:08 bouyer Exp $");
 
 #include "bpfilter.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.45 2003/01/15 21:54:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.46 2003/01/27 10:35:08 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1229,11 +1229,12 @@
                        (sc->memcopyout)(sc, mtod(m,caddr_t), buffer, m->m_len);
                        buffer += m->m_len;
                }
-               if (len < ETHER_MIN_LEN) {
+               len = m0->m_pkthdr.len;
+               if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
                        (sc->memcopyout)(sc, padbuf, buffer,
-                           ETHER_MIN_LEN - len);
-                       buffer += ETHER_MIN_LEN - len;
-                       len = ETHER_MIN_LEN;
+                           ETHER_MIN_LEN - ETHER_CRC_LEN - len);
+                       buffer += ETHER_MIN_LEN -ETHER_CRC_LEN - len;
+                       len = ETHER_MIN_LEN - ETHER_CRC_LEN;
                }
                m_freem(m0);
 



Home | Main Index | Thread Index | Old Index