summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atascsi.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2020-10-15 13:22:12 +0000
committerkrw <krw@openbsd.org>2020-10-15 13:22:12 +0000
commita83ec2865aeaeb867719080e00ad0ac9752d01cc (patch)
tree82ad3a6719ecd9fda92c46891410f2a90c0541e3 /sys/dev/ata/atascsi.c
parentNuke commented out variable declaration. (diff)
downloadwireguard-openbsd-a83ec2865aeaeb867719080e00ad0ac9752d01cc.tar.xz
wireguard-openbsd-a83ec2865aeaeb867719080e00ad0ac9752d01cc.zip
Replace simple one-line bcopy()/memcpy() of faked data into scsi_xfer with call
to scsi_copy_internal_data(). Thus getting xs->resid properly set and adding the usual uio/size sanity checks.
Diffstat (limited to 'sys/dev/ata/atascsi.c')
-rw-r--r--sys/dev/ata/atascsi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c
index bec5c9833fc..550cd7c26eb 100644
--- a/sys/dev/ata/atascsi.c
+++ b/sys/dev/ata/atascsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atascsi.c,v 1.149 2020/09/22 19:32:52 krw Exp $ */
+/* $OpenBSD: atascsi.c,v 1.150 2020/10/15 13:22:13 krw Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -718,7 +718,7 @@ atascsi_disk_inquiry(struct scsi_xfer *xs)
ata_swapcopy(ap->ap_identify.firmware, inq.revision,
sizeof(inq.revision));
- bcopy(&inq, xs->data, MIN(sizeof(inq), xs->datalen));
+ scsi_copy_internal_data(xs, &inq, sizeof(inq));
atascsi_done(xs, XS_NOERROR);
}
@@ -1746,7 +1746,8 @@ atascsi_pmp_inq(struct scsi_xfer *xs)
bcopy("Port Multiplier", inq.product, sizeof(inq.product));
bcopy(" ", inq.revision, sizeof(inq.revision));
- bcopy(&inq, xs->data, MIN(sizeof(inq), xs->datalen));
+ scsi_copy_internal_data(xs, &inq, sizeof(inq));
+
atascsi_done(xs, XS_NOERROR);
}