All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Bruce Rogers <brogers@suse.com>, qemu-devel@nongnu.org
Cc: fam@euphon.net, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
Date: Mon, 29 Apr 2019 20:37:14 -0500	[thread overview]
Message-ID: <3dd36ff4-b51f-fde0-7665-f9ad4eda9194@redhat.com> (raw)
In-Reply-To: <20190429235109.20307-1-brogers@suse.com>

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

On 4/29/19 6:51 PM, Bruce Rogers wrote:
> While investigating link-time-optimization, the compiler flagged this
> case of not handling the error return from scsi_cdb_length(). Handle
> this error case with a trace report.
> 
> Signed-off-by: Bruce Rogers <brogers@suse.com>
> ---
>  hw/scsi/scsi-disk.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index e7e865ab3b..dc13c892ef 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -2520,6 +2520,10 @@ static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf)
>      int len = scsi_cdb_length(buf);
>      char *line_buffer, *p;
>  
> +    if (len < 0) {
> +        trace_scsi_disk_new_request(lun, tag, "bad cdb length!");

I'd drop the !. We aren't shouting at the trace clients, after all :)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-04-30  1:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 23:51 [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length Bruce Rogers
2019-04-29 23:51 ` Bruce Rogers
2019-04-30  1:37 ` Eric Blake [this message]
2019-04-30  2:04   ` Bruce Rogers
2019-04-30  2:04     ` Bruce Rogers
2019-05-01 16:47 ` no-reply
2019-05-01 16:47   ` no-reply

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=3dd36ff4-b51f-fde0-7665-f9ad4eda9194@redhat.com \
    --to=eblake@redhat.com \
    --cc=brogers@suse.com \
    --cc=fam@euphon.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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.