]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
[PATCH] libata: fix WARN_ON() condition in *_fill_sg()
authorTejun Heo <htejun@gmail.com>
Mon, 20 Feb 2006 14:48:37 +0000 (23:48 +0900)
committerJeff Garzik <jgarzik@pobox.com>
Mon, 20 Feb 2006 21:48:17 +0000 (16:48 -0500)
For ATAPI commands, padding can reduce qc->n_elem by one and thus to
zero making assert(qc->n_elem > 0)'s in ata_fill_sg() and qs_fill_sg()
fail for legal commands.  This patch fixes the assert()'s to take
qc->pad_len into account.

Although the condition check seems a bit excessive, as this part of
code isn't still stable yet, I think it's worth to keep those.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/scsi/libata-core.c
drivers/scsi/sata_qstor.c

index 7ddd5a69352a847f4d957e65a06dd95830baa199..bbac87a13d57805b651a40f171f033aad4f5958b 100644 (file)
@@ -2570,7 +2570,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
        unsigned int idx;
 
        assert(qc->__sg != NULL);
-       assert(qc->n_elem > 0);
+       assert(qc->n_elem > 0 || qc->pad_len > 0);
 
        idx = 0;
        ata_for_each_sg(sg, qc) {
index de05e2883f9c4273c64948e1c7e4bee67e420086..80480f0fb2b82abf2ebdcbe156abd994d9b9ff27 100644 (file)
@@ -277,7 +277,7 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
        u8 *prd = pp->pkt + QS_CPB_BYTES;
 
        assert(qc->__sg != NULL);
-       assert(qc->n_elem > 0);
+       assert(qc->n_elem > 0 || qc->pad_len > 0);
 
        nelem = 0;
        ata_for_each_sg(sg, qc) {