Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d7da660

Browse files
danglin44hdeller
authored andcommitted
parisc: Fix sglist access in ccio-dma.c
This patch implements the same bug fix to ccio-dma.c as to sba_iommu.c. It ensures that only the allocated entries of the sglist are accessed. Signed-off-by: John David Anglin <[email protected]> Cc: [email protected] Signed-off-by: Helge Deller <[email protected]>
1 parent b7d6f44 commit d7da660

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/parisc/ccio-dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,14 +1003,15 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
10031003
ioc->usg_calls++;
10041004
#endif
10051005

1006-
while(sg_dma_len(sglist) && nents--) {
1006+
while (nents && sg_dma_len(sglist)) {
10071007

10081008
#ifdef CCIO_COLLECT_STATS
10091009
ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT;
10101010
#endif
10111011
ccio_unmap_page(dev, sg_dma_address(sglist),
10121012
sg_dma_len(sglist), direction, 0);
10131013
++sglist;
1014+
nents--;
10141015
}
10151016

10161017
DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);

0 commit comments

Comments
 (0)