From owner-svn-src-all@FreeBSD.ORG Mon Sep 27 17:46:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26C6D106566C; Mon, 27 Sep 2010 17:46:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 152C58FC0C; Mon, 27 Sep 2010 17:46:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8RHkCGL044283; Mon, 27 Sep 2010 17:46:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8RHkCSU044281; Mon, 27 Sep 2010 17:46:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009271746.o8RHkCSU044281@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 27 Sep 2010 17:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213214 - stable/8/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2010 17:46:13 -0000 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);