X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Flibata-core.c;h=9e58f134f68bf45767813d249220b322a33b005b;hb=6952df035509717bdc46194b2a3d6ffb9349f267;hp=21d194c6ace38b8595b4d6fb6fcfe8fe2cdf341b;hpb=e1dd23a0012c3929737798fda9fede0e783f4ff3;p=linux-2.6 diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 21d194c6ac..9e58f134f6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -2577,7 +2577,6 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) next_sg: sg = &qc->sg[qc->cursg]; -next_page: page = sg->page; offset = sg->offset + qc->cursg_ofs; @@ -2585,6 +2584,7 @@ next_page: page = nth_page(page, (offset >> PAGE_SHIFT)); offset %= PAGE_SIZE; + /* don't overrun current sg */ count = min(sg->length - qc->cursg_ofs, bytes); /* don't cross page boundaries */ @@ -2609,8 +2609,6 @@ next_page: kunmap(page); if (bytes) { - if (qc->cursg_ofs < sg->length) - goto next_page; goto next_sg; } }