From: James Bottomley <James.Bottomley@SteelEye.com>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: achim_leubner@adaptec.com,
SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] fix gcc warning on 64 bit compile of gdth
Date: Mon, 03 Jan 2005 17:53:38 -0600 [thread overview]
Message-ID: <1104796418.5506.81.camel@mulgrave> (raw)
In-Reply-To: <20050103225401.GZ26051@parcelfarce.linux.theplanet.co.uk>
On Mon, 2005-01-03 at 22:54 +0000, Al Viro wrote:
> ... and dma_handle *is* dma_addr_t and gets used in exact same driver to
> store the results of the same function (grep for pci_map_page in there).
Fine. But I usually observe the rule of tamper minimally ... drivers
have a nasty habit of sticking to you if you do more than that.
Indeed, now I look at the cleaned up patch, the think will leak DMA
mappings if sense_paddr is zero (which is quite possible, since zero is
a valid bus physical address). However, I'm declaring this too minimal
to bother with ... unless you want to fix it?
James
===== drivers/scsi/gdth.c 1.47 vs edited =====
--- 1.47/drivers/scsi/gdth.c 2005-01-03 10:53:29 -06:00
+++ edited/drivers/scsi/gdth.c 2005-01-03 17:47:54 -06:00
@@ -2945,9 +2945,8 @@
offset = (ulong)scp->sense_buffer & ~PAGE_MASK;
sense_paddr = pci_map_page(ha->pdev,page,offset,
16,PCI_DMA_FROMDEVICE);
- scp->SCp.buffer = (struct scatterlist *)((ulong32)sense_paddr);
- /* high part, if 64bit */
- scp->host_scribble = (char *)(ulong32)((ulong64)sense_paddr >> 32);
+ scp->SCp.dma_handle = sense_paddr;
+
cmdp->OpCode = GDT_WRITE; /* always */
cmdp->BoardNode = LOCALBOARD;
if (mode64) {
@@ -3639,13 +3638,9 @@
else if (scp->SCp.Status == GDTH_MAP_SINGLE)
pci_unmap_page(ha->pdev,scp->SCp.dma_handle,
scp->request_bufflen,scp->SCp.Message);
- if (scp->SCp.buffer) {
- dma_addr_t addr;
- addr = (dma_addr_t)(ulong32)scp->SCp.buffer;
- if (scp->host_scribble)
- addr += (dma_addr_t)((ulong64)(ulong32)scp->host_scribble << 32);
- pci_unmap_page(ha->pdev,addr,16,PCI_DMA_FROMDEVICE);
- }
+ if (scp->SCp.dma_handle)
+ pci_unmap_page(ha->pdev,scp->SCp.dma_handle,16,PCI_DMA_FROMDEVICE);
+
if (ha->status == S_OK) {
scp->SCp.Status = S_OK;
@@ -4830,7 +4825,7 @@
scp->SCp.phase = -1;
scp->SCp.sent_command = -1;
scp->SCp.Status = GDTH_MAP_NONE;
- scp->SCp.buffer = (struct scatterlist *)NULL;
+ scp->SCp.dma_handle = 0;
hanum = NUMDATA(scp->device->host)->hanum;
#ifdef GDTH_STATISTICS
next prev parent reply other threads:[~2005-01-03 23:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-03 21:45 [PATCH] fix gcc warning on 64 bit compile of gdth James Bottomley
2005-01-03 22:43 ` Al Viro
2005-01-03 22:49 ` James Bottomley
2005-01-03 22:54 ` Al Viro
2005-01-03 23:53 ` James Bottomley [this message]
2005-01-04 4:52 ` Al Viro
2005-01-04 8:27 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2005-01-04 9:29 Leubner, Achim
2005-01-04 9:32 ` Arjan van de Ven
2005-01-04 10:29 ` Al Viro
2005-01-05 11:19 ` Christoph Hellwig
2005-01-04 14:55 ` James Bottomley
2005-01-05 11:19 ` Christoph Hellwig
2005-01-04 10:57 Leubner, Achim
2005-01-04 11:53 ` Al Viro
2005-01-04 12:08 Leubner, Achim
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=1104796418.5506.81.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=achim_leubner@adaptec.com \
--cc=linux-scsi@vger.kernel.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox