linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata-core.c:  fix parameter bug on kunmap_atomic() calls
@ 2005-12-13  2:51 Mark Lord
  0 siblings, 0 replies; only message in thread
From: Mark Lord @ 2005-12-13  2:51 UTC (permalink / raw)
  To: Jeff Garzik, IDE/ATA development list

[-- 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-13  2:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-13  2:51 [PATCH] libata-core.c: fix parameter bug on kunmap_atomic() calls Mark Lord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).