All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
@ 2019-04-29 23:51 ` Bruce Rogers
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Rogers @ 2019-04-29 23:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, fam, Bruce Rogers

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!");
+        return;
+    }
     line_buffer = g_malloc(len * 5 + 1);
 
     for (i = 0, p = line_buffer; i < len; i++) {
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
@ 2019-04-29 23:51 ` Bruce Rogers
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Rogers @ 2019-04-29 23:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: fam, pbonzini, Bruce Rogers

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!");
+        return;
+    }
     line_buffer = g_malloc(len * 5 + 1);
 
     for (i = 0, p = line_buffer; i < len; i++) {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
  2019-04-29 23:51 ` Bruce Rogers
  (?)
@ 2019-04-30  1:37 ` Eric Blake
  2019-04-30  2:04     ` Bruce Rogers
  -1 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2019-04-30  1:37 UTC (permalink / raw)
  To: Bruce Rogers, qemu-devel; +Cc: fam, pbonzini

[-- 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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
@ 2019-04-30  2:04     ` Bruce Rogers
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Rogers @ 2019-04-30  2:04 UTC (permalink / raw)
  To: qemu-devel, eblake; +Cc: fam, Paolo Bonzini

>>> On 4/29/2019 at 7:37 PM, Eric Blake <eblake@redhat.com> wrote:
> 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 :)

Got it.

Bruce

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
@ 2019-04-30  2:04     ` Bruce Rogers
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Rogers @ 2019-04-30  2:04 UTC (permalink / raw)
  To: qemu-devel, eblake; +Cc: fam, Paolo Bonzini

>>> On 4/29/2019 at 7:37 PM, Eric Blake <eblake@redhat.com> wrote:
> 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 :)

Got it.

Bruce



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
@ 2019-05-01 16:47   ` no-reply
  0 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2019-05-01 16:47 UTC (permalink / raw)
  To: brogers; +Cc: fam, qemu-devel

Patchew URL: https://patchew.org/QEMU/20190429235109.20307-1-brogers@suse.com/



Hi,

This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20190429235109.20307-1-brogers@suse.com/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-disk: handle invalid cdb length
@ 2019-05-01 16:47   ` no-reply
  0 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2019-05-01 16:47 UTC (permalink / raw)
  To: brogers; +Cc: fam, pbonzini, qemu-devel, brogers

Patchew URL: https://patchew.org/QEMU/20190429235109.20307-1-brogers@suse.com/



Hi,

This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20190429235109.20307-1-brogers@suse.com/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-05-01 17:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.