summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-11-03 00:03:03 +0000
committerwpaul <wpaul@FreeBSD.org>2000-11-03 00:03:03 +0000
commita963a930c8592323538a6820bcd2beb40fb19b8f (patch)
treed06bf43083436f52360703c5d7d47a98e44fa4d8 /sys
parente3e49a5355134973cfc01c1a575f1a4931f5fc52 (diff)
downloadFreeBSD-src-a963a930c8592323538a6820bcd2beb40fb19b8f.zip
FreeBSD-src-a963a930c8592323538a6820bcd2beb40fb19b8f.tar.gz
Grrrr. Remember to bzero() the mediainfo structures after we allocate
them. If we leave garbage in them, the dc_apply_fixup() routine may try to follow bogus pointers when applying the reset fixup. Noticed by: Andrew Gallatin
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/dc/if_dc.c3
-rw-r--r--sys/pci/if_dc.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 0d3f652..ad53f89 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -1635,6 +1635,7 @@ static void dc_decode_leaf_sia(sc, l)
struct dc_mediainfo *m;
m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT);
+ bzero(m, sizeof(struct dc_mediainfo));
if (l->dc_sia_code == DC_SIA_CODE_10BT)
m->dc_media = IFM_10_T;
@@ -1665,6 +1666,7 @@ static void dc_decode_leaf_sym(sc, l)
struct dc_mediainfo *m;
m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT);
+ bzero(m, sizeof(struct dc_mediainfo));
if (l->dc_sym_code == DC_SYM_CODE_100BT)
m->dc_media = IFM_100_TX;
@@ -1690,6 +1692,7 @@ static void dc_decode_leaf_mii(sc, l)
struct dc_mediainfo *m;
m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT);
+ bzero(m, sizeof(struct dc_mediainfo));
/* We abuse IFM_AUTO to represent MII. */
m->dc_media = IFM_AUTO;
m->dc_gp_len = l->dc_gpr_len;
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index 0d3f652..ad53f89 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/if_dc.c
@@ -1635,6 +1635,7 @@ static void dc_decode_leaf_sia(sc, l)
struct dc_mediainfo *m;
m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT);
+ bzero(m, sizeof(struct dc_mediainfo));
if (l->dc_sia_code == DC_SIA_CODE_10BT)
m->dc_media = IFM_10_T;
@@ -1665,6 +1666,7 @@ static void dc_decode_leaf_sym(sc, l)
struct dc_mediainfo *m;
m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT);
+ bzero(m, sizeof(struct dc_mediainfo));
if (l->dc_sym_code == DC_SYM_CODE_100BT)
m->dc_media = IFM_100_TX;
@@ -1690,6 +1692,7 @@ static void dc_decode_leaf_mii(sc, l)
struct dc_mediainfo *m;
m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT);
+ bzero(m, sizeof(struct dc_mediainfo));
/* We abuse IFM_AUTO to represent MII. */
m->dc_media = IFM_AUTO;
m->dc_gp_len = l->dc_gpr_len;
OpenPOWER on IntegriCloud