Commit dfa15988 authored by Mark Lord's avatar Mark Lord Committed by Jeff Garzik

[PATCH] libata-core.c: fix parameter bug on kunmap_atomic() calls

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: default avatarMark Lord <liml@rtr.ca>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 0e670506
...@@ -2443,7 +2443,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) ...@@ -2443,7 +2443,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
struct scatterlist *psg = &qc->pad_sgent; struct scatterlist *psg = &qc->pad_sgent;
void *addr = kmap_atomic(psg->page, KM_IRQ0); void *addr = kmap_atomic(psg->page, KM_IRQ0);
memcpy(addr + psg->offset, pad_buf, qc->pad_len); memcpy(addr + psg->offset, pad_buf, qc->pad_len);
kunmap_atomic(psg->page, KM_IRQ0); kunmap_atomic(addr, KM_IRQ0);
} }
} else { } else {
if (sg_dma_len(&sg[0]) > 0) if (sg_dma_len(&sg[0]) > 0)
...@@ -2717,7 +2717,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) ...@@ -2717,7 +2717,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
if (qc->tf.flags & ATA_TFLAG_WRITE) { if (qc->tf.flags & ATA_TFLAG_WRITE) {
void *addr = kmap_atomic(psg->page, KM_IRQ0); void *addr = kmap_atomic(psg->page, KM_IRQ0);
memcpy(pad_buf, addr + psg->offset, qc->pad_len); 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); sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment