提交 0106372d 编写于 作者: A Albert Lee 提交者: Jeff Garzik

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: NAlbert Lee <albertcc@tw.ibm.com>
Signed-off-by: NTejun Heo <htejun@gmail.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 93f8fecb
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册