| Kernel v2.4.1 /drivers/ide/ide-dma.c |
|---|
 2.4.1
 drivers
 ide
 ide-dma.c
diff -u --recursive --new-file v2.4.0/linux/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
--- v2.4.0/linux/drivers/ide/ide-dma.c Tue Jan 2 16:58:45 2001
+++ linux/drivers/ide/ide-dma.c Mon Jan 15 13:08:15 2001
@@ -226,6 +226,9 @@
unsigned char *virt_addr = bh->b_data;
unsigned int size = bh->b_size;
+ if (nents >= PRD_ENTRIES)
+ return 0;
+
while ((bh = bh->b_reqnext) != NULL) {
if ((virt_addr + size) != (unsigned char *) bh->b_data)
break;
@@ -259,6 +262,9 @@
HWIF(drive)->sg_nents = i = ide_build_sglist(HWIF(drive), HWGROUP(drive)->rq);
+ if (!i)
+ return 0;
+
sg = HWIF(drive)->sg_table;
while (i && sg_dma_len(sg)) {
u32 cur_addr;
@@ -274,7 +280,7 @@
*/
while (cur_len) {
- if (++count >= PRD_ENTRIES) {
+ if (count++ >= PRD_ENTRIES) {
printk("%s: DMA table too small\n", drive->name);
pci_unmap_sg(HWIF(drive)->pci_dev,
HWIF(drive)->sg_table,
|