Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0106372db6dc135f300035ce8e93cddd7283a26a
Commit:     0106372db6dc135f300035ce8e93cddd7283a26a
Parent:     93f8fecbe72bc3c121f3605dd198ff39ef358522
Author:     Albert Lee <[EMAIL PROTECTED]>
AuthorDate: Wed Dec 5 16:43:02 2007 +0900
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jan 23 05:24:13 2008 -0500

    libata: zero xfer length on ATAPI data xfer IRQ is HSM violation
    
    Treat zero xfer length as HSM violation.  While at it, add
    unlikely()'s to ATAPI ireason and transfer length checks.
    
    tj: Formatted patch and added unlikely()'s.
    
    Signed-off-by: Albert Lee <[EMAIL PROTECTED]>
    Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2b57547..c9e6bd4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5309,12 +5309,15 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
        bytes = (bc_hi << 8) | bc_lo;
 
        /* shall be cleared to zero, indicating xfer of data */
-       if (ireason & (1 << 0))
+       if (unlikely(ireason & (1 << 0)))
                goto err_out;
 
        /* make sure transfer direction matches expected */
        i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0;
-       if (do_write != i_write)
+       if (unlikely(do_write != i_write))
+               goto err_out;
+
+       if (unlikely(!bytes))
                goto err_out;
 
        VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to