From owner-svn-src-all@FreeBSD.ORG Fri Aug 27 23:50:14 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 3812C106566C; Fri, 27 Aug 2010 23:50:14 +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 27F4E8FC16; Fri, 27 Aug 2010 23:50:14 +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 o7RNoE6E011442; Fri, 27 Aug 2010 23:50:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7RNoEt5011440; Fri, 27 Aug 2010 23:50:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008272350.o7RNoEt5011440@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 27 Aug 2010 23:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211906 - head/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: Fri, 27 Aug 2010 23:50:14 -0000 Author: yongari Date: Fri Aug 27 23:50:13 2010 New Revision: 211906 URL: http://svn.freebsd.org/changeset/base/211906 Log: Make sure not to access unallocated stats memory. Reviewed by: jfv Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Fri Aug 27 23:24:08 2010 (r211905) +++ head/sys/dev/e1000/if_igb.c Fri Aug 27 23:50:13 2010 (r211906) @@ -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);