svn commit: r213214 - stable/8/sys/dev/e1000
Pyun YongHyeon
yongari at FreeBSD.org
Mon Sep 27 17:46:13 UTC 2010
Author: yongari
Date: Mon Sep 27 17:46:11 2010
New Revision: 213214
URL: http://svn.freebsd.org/changeset/base/213214
Log:
MFC r211906:
Make sure not to access unallocated stats memory.
Reviewed by: jfv
Modified:
stable/8/sys/dev/e1000/if_igb.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/dev/e1000/if_igb.c
==============================================================================
--- stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:38:30 2010 (r213213)
+++ stable/8/sys/dev/e1000/if_igb.c Mon Sep 27 17:46:11 2010 (r213214)
@@ -509,6 +509,11 @@ igb_attach(device_t dev)
adapter->stats =
(struct e1000_hw_stats *)malloc(sizeof \
(struct e1000_hw_stats), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (adapter->stats == NULL) {
+ device_printf(dev, "Can not allocate stats memory\n");
+ error = ENOMEM;
+ goto err_late;
+ }
/*
** Start from a known state, this is
@@ -4893,7 +4898,8 @@ igb_vf_init_stats(struct adapter *adapte
struct e1000_vf_stats *stats;
stats = (struct e1000_vf_stats *)adapter->stats;
-
+ if (stats == NULL)
+ return;
stats->last_gprc = E1000_READ_REG(hw, E1000_VFGPRC);
stats->last_gorc = E1000_READ_REG(hw, E1000_VFGORC);
stats->last_gptc = E1000_READ_REG(hw, E1000_VFGPTC);
More information about the svn-src-all
mailing list