From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 1/2] sata: fix sata_sx4 dma_prep to not use sg->length Date: Sun, 7 Aug 2005 14:53:40 +0900 Message-ID: <20050807055340.GB13335@htj.dyndns.org> References: <20050729050654.GA10413@havoc.gtf.org> <20050807054850.GA13335@htj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20050807054850.GA13335@htj.dyndns.org> Sender: linux-scsi-owner@vger.kernel.org To: Jeff Garzik Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe , Alan Cox List-Id: linux-ide@vger.kernel.org sata_sx4 directly references sg->length to calculate total_len in pdc20621_dma_prep(). This is incorrect as dma_map_sg() could have merged multiple sg's into one and, in such case, sg->length doesn't reflect true size of the entry. This patch makes it use sg_dma_len(sg). Signed-off-by: Tejun Heo Index: work/drivers/scsi/sata_sx4.c =================================================================== --- work.orig/drivers/scsi/sata_sx4.c 2005-08-07 14:07:17.000000000 +0900 +++ work/drivers/scsi/sata_sx4.c 2005-08-07 14:08:25.000000000 +0900 @@ -468,7 +468,7 @@ static void pdc20621_dma_prep(struct ata for (i = 0; i < last; i++) { buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i])); buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i])); - total_len += sg[i].length; + total_len += sg_dma_len(&sg[i]); } buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT); sgt_len = idx * 4;