scsi-disk: handle invalid cdb length
PATCH 1/1 scsi-disk: handle invalid cdb length
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.
--- hw/scsi/scsi-disk.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/scsi/scsi-disk.c +4 -0
@@ -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++) {
Signature · 1 line
2.21.0
Quoted 14 lines · 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 <[email protected]>--- hw/scsi/scsi-disk.c | 4 ++++ 1 file changed, 4 insertions(+)hw/scsi/scsi-disk.c +0
-0
hw/scsi/scsi-disk.c static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf) · line 2524
Quoted 5 lines
hw/scsi/scsi-disk.c +2
-0@@ -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 :)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Eric Blake
hw/scsi/scsi-disk.c static void scsi_disk_new_request_dump(uint32_t lun,
Quoted 14 lines · 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 <[email protected]>--- hw/scsi/scsi-disk.c | 4 ++++ 1 file changed, 4 insertions(+)hw/scsi/scsi-disk.c +0
-0@@ -2520,6 +2520,10 @@ static void scsi_disk_new_request_dump(uint32_t lun,
uint32_ttag,uint8_t*buf)
Quoted 7 lines
hw/scsi/scsi-disk.c static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf) · line 2524
Quoted 5 lines
hw/scsi/scsi-disk.c +2
-0int 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
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
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/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]