summaryrefslogtreecommitdiff
path: root/scsi.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2015-02-06 13:36:26 +0100
committerDmitry V. Levin <ldv@altlinux.org>2015-02-08 01:42:00 +0000
commit0014bb1b9dbb6c255b40ceb7b71c60bd198b41b2 (patch)
tree73a8e558cbcda7c00438de3f3d26a59a6a10b679 /scsi.c
parentea6972c1625b47baabbe4fa8ac009e31901c11bd (diff)
downloadstrace-0014bb1b9dbb6c255b40ceb7b71c60bd198b41b2.tar.gz
scsi: on exit, print only initialized part of the buffer
* scsi.c (print_sg_io_res): Only print that part of the data in buffer that has been initialized by the SCSI LLD driver. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'scsi.c')
-rw-r--r--scsi.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/scsi.c b/scsi.c
index 1ca74b8b9..5a6838f65 100644
--- a/scsi.c
+++ b/scsi.c
@@ -88,9 +88,13 @@ print_sg_io_res(struct tcb *tcp, struct sg_io_hdr *sg_io)
{
if (sg_io->dxfer_direction == SG_DXFER_FROM_DEV ||
sg_io->dxfer_direction == SG_DXFER_TO_FROM_DEV) {
- tprintf(", data[%u]=[", sg_io->dxfer_len);
- printstr(tcp, (unsigned long) sg_io->dxferp,
- sg_io->dxfer_len);
+ uint32_t din_len = sg_io->dxfer_len;
+
+ if (sg_io->resid > 0)
+ din_len -= sg_io->resid;
+
+ tprintf(", data[%u]=[", din_len);
+ printstr(tcp, (unsigned long) sg_io->dxferp, din_len);
tprints("]");
}
tprintf(", status=%02x, ", sg_io->status);