All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH] libata-core.c:  fix parameter bug on kunmap_atomic() calls
Date: Mon, 12 Dec 2005 21:51:20 -0500	[thread overview]
Message-ID: <439E3728.6090007@rtr.ca> (raw)

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

Fix incorrect pointer usage on two calls to kunmap_atomic().
This seems to happen a lot, because kunmap() wants the struct page *,
whereas kunmap_atomic() instead wants the mapped virtual address.

Signed-off-by:  Mark Lord <liml@rtr.ca>

--- linux-2.6.15-rc5/drivers/scsi/libata-core.c.orig    2005-12-11 18:56:23.000000000 -0500
+++ linux/drivers/scsi/libata-core.c    2005-12-12 21:46:04.000000000 -0500
@@ -2447,7 +2447,7 @@
                         struct scatterlist *psg = &qc->pad_sgent;
                         void *addr = kmap_atomic(psg->page, KM_IRQ0);
                         memcpy(addr + psg->offset, pad_buf, qc->pad_len);
-                       kunmap_atomic(psg->page, KM_IRQ0);
+                       kunmap_atomic(addr, KM_IRQ0);
                 }
         } else {
                 if (sg_dma_len(&sg[0]) > 0)
@@ -2721,7 +2721,7 @@
                 if (qc->tf.flags & ATA_TFLAG_WRITE) {
                         void *addr = kmap_atomic(psg->page, KM_IRQ0);
                         memcpy(pad_buf, addr + psg->offset, qc->pad_len);
-                       kunmap_atomic(psg->page, KM_IRQ0);
+                       kunmap_atomic(addr, KM_IRQ0);
                 }

                 sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);

[-- Attachment #2: libata.patch --]
[-- Type: text/x-patch, Size: 768 bytes --]

--- linux-2.6.15-rc5/drivers/scsi/libata-core.c.orig	2005-12-11 18:56:23.000000000 -0500
+++ linux/drivers/scsi/libata-core.c	2005-12-12 21:46:04.000000000 -0500
@@ -2447,7 +2447,7 @@
 			struct scatterlist *psg = &qc->pad_sgent;
 			void *addr = kmap_atomic(psg->page, KM_IRQ0);
 			memcpy(addr + psg->offset, pad_buf, qc->pad_len);
-			kunmap_atomic(psg->page, KM_IRQ0);
+			kunmap_atomic(addr, KM_IRQ0);
 		}
 	} else {
 		if (sg_dma_len(&sg[0]) > 0)
@@ -2721,7 +2721,7 @@
 		if (qc->tf.flags & ATA_TFLAG_WRITE) {
 			void *addr = kmap_atomic(psg->page, KM_IRQ0);
 			memcpy(pad_buf, addr + psg->offset, qc->pad_len);
-			kunmap_atomic(psg->page, KM_IRQ0);
+			kunmap_atomic(addr, KM_IRQ0);
 		}
 
 		sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);

                 reply	other threads:[~2005-12-13  2:51 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=439E3728.6090007@rtr.ca \
    --to=liml@rtr.ca \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /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.