All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Netdev <netdev@oss.sgi.com>
Subject: [PATCH] forcedeth: Fix incorrect parameters in pci_unmap_single calls
Date: Thu, 22 Dec 2005 23:05:34 +0100	[thread overview]
Message-ID: <43AB232E.7050309@colorfullife.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

Hi,

The natsemi rx codepath calls pci_unmap_single with a different size 
than the initial pci_map_single call.
The attached patch fixes that.

Signed-Off-By: Manfred Spraul <manfred@colorfullife.com>

[-- Attachment #2: patch-natsemi-rxunmapsize --]
[-- Type: text/plain, Size: 1489 bytes --]

--- 2.6/drivers/net/natsemi.c	2005-12-19 01:36:54.000000000 +0100
+++ x64/drivers/net/natsemi.c	2005-12-22 22:10:56.000000000 +0100
@@ -1920,6 +1920,7 @@
 		int entry = np->dirty_rx % RX_RING_SIZE;
 		if (np->rx_skbuff[entry] == NULL) {
 			unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
+
 			skb = dev_alloc_skb(buflen);
 			np->rx_skbuff[entry] = skb;
 			if (skb == NULL)
@@ -2006,7 +2007,6 @@
 static void drain_rx(struct net_device *dev)
 {
 	struct netdev_private *np = netdev_priv(dev);
-	unsigned int buflen = np->rx_buf_sz;
 	int i;
 
 	/* Free all the skbuffs in the Rx queue. */
@@ -2014,6 +2014,8 @@
 		np->rx_ring[i].cmd_status = 0;
 		np->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
 		if (np->rx_skbuff[i]) {
+			unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
+
 			pci_unmap_single(np->pci_dev,
 				np->rx_dma[i], buflen,
 				PCI_DMA_FROMDEVICE);
@@ -2225,7 +2227,6 @@
 	int entry = np->cur_rx % RX_RING_SIZE;
 	int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
 	s32 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status);
-	unsigned int buflen = np->rx_buf_sz;
 	void __iomem * ioaddr = ns_ioaddr(dev);
 
 	/* If the driver owns the next entry it's a new packet. Send it up. */
@@ -2267,6 +2268,8 @@
 			 */
 		} else {
 			struct sk_buff *skb;
+			unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
+
 			/* Omit CRC size. */
 			/* Check if the packet is long enough to accept
 			 * without copying to a minimally-sized skbuff. */

                 reply	other threads:[~2005-12-22 22:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43AB232E.7050309@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.