From ba7f2ad41b66c94a777bb93f4cd5481f195dfba4 Mon Sep 17 00:00:00 2001 From: bouyer Date: Wed, 15 Jan 2003 22:00:43 +0000 Subject: [PATCH] Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN --- sys/dev/isa/if_eg.c | 6 ++++-- sys/dev/isa/if_el.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index 1b32af89e612..9825430cf224 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_eg.c,v 1.60 2002/10/02 03:10:47 thorpej Exp $ */ +/* $NetBSD: if_eg.c,v 1.61 2003/01/15 22:00:43 bouyer Exp $ */ /* * Copyright (c) 1993 Dean Huxley @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.60 2002/10/02 03:10:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.61 2003/01/15 22:00:43 bouyer Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -659,6 +659,8 @@ loop: memcpy(buffer, mtod(m, caddr_t), m->m_len); buffer += m->m_len; } + if (len > m0->m_pkthdr.len) + memset(buffer, 0, len - m0->m_pkthdr.len); /* set direction bit: host -> adapter */ bus_space_write_1(iot, ioh, EG_CONTROL, diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index af520996f78b..e48714a89734 100644 --- a/sys/dev/isa/if_el.c +++ b/sys/dev/isa/if_el.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_el.c,v 1.69 2002/10/02 03:10:47 thorpej Exp $ */ +/* $NetBSD: if_el.c,v 1.70 2003/01/15 22:01:16 bouyer Exp $ */ /* * Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.69 2002/10/02 03:10:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.70 2003/01/15 22:01:16 bouyer Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -432,6 +432,9 @@ elstart(ifp) for (m = m0; m != 0; m = m->m_next) bus_space_write_multi_1(iot, ioh, EL_BUF, mtod(m, u_int8_t *), m->m_len); + for (i = 0; + i < ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len; i++) + bus_space_write_1(iot, ioh, EL_BUF, 0); m_freem(m0);