Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Ye Bin <yebin10@huawei.com>,
	axboe@kernel.dk, linux-ide@vger.kernel.org, hch@infradead.org
Subject: Re: [PATCH v2] ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function
Date: Wed, 3 Jun 2020 15:04:37 +0200	[thread overview]
Message-ID: <18288afe-efea-a670-c9da-3827f4f2ec0c@redhat.com> (raw)
In-Reply-To: <20200603123924.135160-1-yebin10@huawei.com>

On 03/06/20 14:39, Ye Bin wrote:
>  	if (!scsi_sg_count(scmd) || scsi_sglist(scmd)->length < len)
>  		goto invalid_param_len;
>  
> -	p = page_address(sg_page(scsi_sglist(scmd)));
> -
>  	/* Move past header and block descriptors.  */
>  	if (len < hdr_len)
>  		goto invalid_param_len;
>  
> +	if (sg_copy_to_buffer(scsi_sglist(scmd), scsi_sg_count(scmd),
> +			      buffer, 64) != 64)
> +		goto invalid_param_len;
> +
>  	if (six_byte)
>  		bd_len = p[3];
>  	else

You should not check that the number of copied bytes is 64; it will be
less than that in most cases (because CACHE_MPAGE_LEN+8+8+4-2 is less
than 64).

How did you test this patch?

Thanks,

Paolo


      reply	other threads:[~2020-06-03 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 12:39 [PATCH v2] ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function Ye Bin
2020-06-03 13:04 ` Paolo Bonzini [this message]

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=18288afe-efea-a670-c9da-3827f4f2ec0c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=yebin10@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox