From: Jens Axboe <axboe@kernel.dk>
To: Paolo Bonzini <pbonzini@redhat.com>, Ye Bin <yebin10@huawei.com>,
hch@infradead.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v3] ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function
Date: Thu, 4 Jun 2020 12:08:37 -0600 [thread overview]
Message-ID: <ce4440a8-4d8b-3f47-7ce3-492289dcbb32@kernel.dk> (raw)
In-Reply-To: <882cdc0e-6468-d171-28aa-bd90969562cf@redhat.com>
On 6/4/20 5:04 AM, Paolo Bonzini wrote:
> On 04/06/20 11:31, Ye Bin wrote:
>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>> index 435781a16875..03dd265c30be 100644
>> --- a/drivers/ata/libata-scsi.c
>> +++ b/drivers/ata/libata-scsi.c
>> @@ -3684,12 +3684,13 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
>> {
>> struct scsi_cmnd *scmd = qc->scsicmd;
>> const u8 *cdb = scmd->cmnd;
>> - const u8 *p;
>> u8 pg, spg;
>> unsigned six_byte, pg_len, hdr_len, bd_len;
>> int len;
>> u16 fp = (u16)-1;
>> u8 bp = 0xff;
>> + u8 buffer[64];
>> + const u8 *p = buffer;
>>
>> VPRINTK("ENTER\n");
>>
>> @@ -3723,12 +3724,14 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
>> 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))
>
> sizeof(buffer) would be better. But anyway:
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Perhaps the maintainer can fix it up on commit.
Please resend it it, thanks.
--
Jens Axboe
prev parent reply other threads:[~2020-06-04 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 9:31 [PATCH v3] ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function Ye Bin
2020-06-04 11:04 ` Paolo Bonzini
2020-06-04 18:08 ` Jens Axboe [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=ce4440a8-4d8b-3f47-7ce3-492289dcbb32@kernel.dk \
--to=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=pbonzini@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).