From: Paolo Bonzini <pbonzini@redhat.com>
To: linzhecheng <linzhecheng@huawei.com>, qemu-devel@nongnu.org
Cc: famz@redhat.com, wangxinxin.wang@huawei.com
Subject: Re: [Qemu-devel] [PATCH] scsi: handle the special parameters
Date: Mon, 15 Jan 2018 10:29:32 +0100 [thread overview]
Message-ID: <2a6ca84f-4df2-523c-d3aa-75cd73b1d739@redhat.com> (raw)
In-Reply-To: <20180115041648.33740-1-linzhecheng@huawei.com>
On 15/01/2018 05:16, linzhecheng wrote:
> scsi_disk_emulate_command calls
> scsi_build_sense(NULL, 0, outbuf, r->buflen,
> (req->cmd.buf[1] & 1) == 0);
> But scsi_convert_sense doesn't handle the case when in_buf is NULL
> or in_len is 0, which will lead to segfault.
>
This is already fixed in my last pull request.
Paolo
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> ---
> scsi/utils.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scsi/utils.c b/scsi/utils.c
> index ddae650a99..b769e80c12 100644
> --- a/scsi/utils.c
> +++ b/scsi/utils.c
> @@ -322,6 +322,10 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len,
> SCSISense sense;
> bool fixed_in;
>
> + if (!in_buf || !in_len) {
> + return 0;
> + }
> +
> fixed_in = (in_buf[0] & 2) == 0;
> if (in_len && fixed == fixed_in) {
> memcpy(buf, in_buf, MIN(len, in_len));
>
prev parent reply other threads:[~2018-01-15 9:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 4:16 [Qemu-devel] [PATCH] scsi: handle the special parameters linzhecheng
2018-01-15 9:29 ` 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=2a6ca84f-4df2-523c-d3aa-75cd73b1d739@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=linzhecheng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=wangxinxin.wang@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).