All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Tejun Heo <htejun@gmail.com>
Cc: jeff@garzik.org, linux-ide@vger.kernel.org,
	alan@lxorguk.ukuu.org.uk, liml@rtr.ca, albertl@mail.com,
	jens.axboe@oracle.com
Subject: Re: [PATCH 02/15] libata: zero xfer length on ATAPI data xfer IRQ is HSM violation
Date: Thu, 06 Dec 2007 14:44:23 +0800	[thread overview]
Message-ID: <47579A47.9090908@tw.ibm.com> (raw)
In-Reply-To: <11968405953773-git-send-email-htejun@gmail.com>

Tejun Heo wrote:
> From: Albert Lee <albertcc@tw.ibm.com>
> 
> 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 <albertcc@tw.ibm.com>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
>  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 597e07c..88f7637 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -5280,12 +5280,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);


Looks good.

Acked-by: Albert Lee <albertcc@tw.ibm.com>


  reply	other threads:[~2007-12-06  6:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-05  7:43 [PATCHSET] libata: improve ATAPI data transfer handling, take #3 Tejun Heo
2007-12-05  7:43 ` [PATCH 01/15] libata: make atapi_request_sense() use sg Tejun Heo
2007-12-18 21:30   ` Jeff Garzik
2007-12-05  7:43 ` [PATCH 02/15] libata: zero xfer length on ATAPI data xfer IRQ is HSM violation Tejun Heo
2007-12-06  6:44   ` Albert Lee [this message]
2007-12-05  7:43 ` [PATCH 03/15] libata: update atapi_eh_request_sense() such that lbam/lbah contains buffer size Tejun Heo
2007-12-05  7:43 ` [PATCH 04/15] cdrom: add more GPCMD_* constants Tejun Heo
2007-12-05  7:43 ` [PATCH 05/15] libata: rename ATA_PROT_ATAPI_* to ATAPI_PROT_* Tejun Heo
2007-12-18 21:35   ` Jeff Garzik
2007-12-05  7:43 ` [PATCH 06/15] libata: add ATAPI_* cmd types and implement atapi_cmd_type() Tejun Heo
2007-12-05  7:43 ` [PATCH 07/15] change-data_xfer Tejun Heo
2007-12-18 21:38   ` Jeff Garzik
2007-12-05  7:43 ` [PATCH 08/15] libata: improve ATAPI draining Tejun Heo
2007-12-06  6:47   ` Albert Lee
2007-12-18 21:41   ` Jeff Garzik
2007-12-05  7:43 ` [PATCH 09/15] libata: kill non-sg DMA interface Tejun Heo
2007-12-05  7:43 ` [PATCH 10/15] libata: change ATA_QCFLAG_DMAMAP semantics Tejun Heo
2007-12-05  7:43 ` [PATCH 11/15] libata: convert to chained sg Tejun Heo
2007-12-05  7:43 ` [PATCH 12/15] libata: make qc->nbytes include extra buffers Tejun Heo
2007-12-18 21:44   ` Jeff Garzik
2007-12-05  7:43 ` [PATCH 13/15] libata: implement ATAPI drain buffer Tejun Heo
2007-12-18 21:45   ` Jeff Garzik
2007-12-05  7:43 ` [PATCH 14/15] libata: implement ATAPI per-command-type DMA horkages Tejun Heo
2007-12-05  7:43 ` [PATCH 15/15] libata: use PIO for misc ATAPI commands Tejun Heo
2007-12-05 13:00   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47579A47.9090908@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertl@mail.com \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=jens.axboe@oracle.com \
    --cc=liml@rtr.ca \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.