diff options
author | 2020-10-15 13:22:12 +0000 | |
---|---|---|
committer | 2020-10-15 13:22:12 +0000 | |
commit | a83ec2865aeaeb867719080e00ad0ac9752d01cc (patch) | |
tree | 82ad3a6719ecd9fda92c46891410f2a90c0541e3 /sys/dev/pci/ips.c | |
parent | Nuke commented out variable declaration. (diff) | |
download | wireguard-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/pci/ips.c')
-rw-r--r-- | sys/dev/pci/ips.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index 178cdfaa448..925a283b26f 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ips.c,v 1.132 2020/09/22 19:32:53 krw Exp $ */ +/* $OpenBSD: ips.c,v 1.133 2020/10/15 13:22:13 krw Exp $ */ /* * Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org> @@ -922,19 +922,19 @@ ips_scsi_cmd(struct scsi_xfer *xs) snprintf(inq.product, sizeof(inq.product), "LD%d RAID%d", target, drive->raid); strlcpy(inq.revision, "1.0", sizeof(inq.revision)); - memcpy(xs->data, &inq, MIN(xs->datalen, sizeof(inq))); + scsi_copy_internal_data(xs, &inq, sizeof(inq)); break; case READ_CAPACITY: bzero(&rcd, sizeof(rcd)); _lto4b(letoh32(drive->seccnt) - 1, rcd.addr); _lto4b(IPS_SECSZ, rcd.length); - memcpy(xs->data, &rcd, MIN(xs->datalen, sizeof(rcd))); + scsi_copy_internal_data(xs, &rcd, sizeof(rcd)); break; case REQUEST_SENSE: bzero(&sd, sizeof(sd)); sd.error_code = SSD_ERRCODE_CURRENT; sd.flags = SKEY_NO_SENSE; - memcpy(xs->data, &sd, MIN(xs->datalen, sizeof(sd))); + scsi_copy_internal_data(xs, &sd, sizeof(sd)); break; case SYNCHRONIZE_CACHE: cmd = ccb->c_cmdbva; |