lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1369037707-27026-5-git-send-email-weiyang@linux.vnet.ibm.com>
Date:	Mon, 20 May 2013 16:15:07 +0800
From:	Wei Yang <weiyang@...ux.vnet.ibm.com>
To:	jeffrey.t.kirsher@...el.com
Cc:	e1000-devel@...ts.sourceforge.net, netdev@...r.kernel.org,
	Wei Yang <weiyang@...ux.vnet.ibm.com>
Subject: [PATCH 4/4] e1000e: Not initialize the e1000_ps_page array when packet-split is not used

When packet split is not used, those fields are still initialized and memory
is allocated for them.

This patch check whether packet split is used and do the initialization base
on the status.

Signed-off-by: Wei Yang <weiyang@...ux.vnet.ibm.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c |   38 ++++++++++++++-------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index a2e8a53..c75d9cf 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1690,15 +1690,17 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
 			buffer_info->skb = NULL;
 		}
 
-		for (j = 0; j < PS_PAGE_BUFFERS; j++) {
-			ps_page = &buffer_info->ps_pages[j];
-			if (!ps_page->page)
-				break;
-			dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE,
-				       DMA_FROM_DEVICE);
-			ps_page->dma = 0;
-			put_page(ps_page->page);
-			ps_page->page = NULL;
+		if (adapter->rx_ps_pages) {
+			for (j = 0; j < PS_PAGE_BUFFERS; j++) {
+				ps_page = &buffer_info->ps_pages[j];
+				if (!ps_page->page)
+					break;
+				dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE,
+					       DMA_FROM_DEVICE);
+				ps_page->dma = 0;
+				put_page(ps_page->page);
+				ps_page->page = NULL;
+			}
 		}
 	}
 
@@ -2355,16 +2357,16 @@ int e1000e_setup_rx_resources(struct e1000_ring *rx_ring)
 	if (!rx_ring->buffer_info)
 		goto err;
 
-	for (i = 0; i < rx_ring->count; i++) {
-		buffer_info = &rx_ring->buffer_info[i];
-		buffer_info->ps_pages = kcalloc(PS_PAGE_BUFFERS,
-						sizeof(struct e1000_ps_page),
-						GFP_KERNEL);
-		if (!buffer_info->ps_pages)
-			goto err_pages;
-	}
-
 	if (adapter->rx_ps_pages) {
+		for (i = 0; i < rx_ring->count; i++) {
+			buffer_info = &rx_ring->buffer_info[i];
+			buffer_info->ps_pages = kcalloc(PS_PAGE_BUFFERS,
+							sizeof(struct e1000_ps_page),
+							GFP_KERNEL);
+			if (!buffer_info->ps_pages)
+				goto err_pages;
+		}
+
 		/* this is a 32 byte descriptor */
 		desc_len = sizeof(union e1000_rx_desc_packet_split);
 	} else {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ