summaryrefslogtreecommitdiff
path: root/sys/scsi/scsi_ioctl.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-12-08 14:02:48 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-12-08 14:02:48 +0000
commit9a3eda10c4f376bb34bcc10f78d2fd1b8b1e53d5 (patch)
tree0eff35f98f39b661fd110faa0cd6b6e51e205942 /sys/scsi/scsi_ioctl.c
parent1e6de3f4f18390ef34fecf4a5d1ca38677fc0ce4 (diff)
Don't panic for pathological i/o sizes unless minphys() really is
broken. Eliminate an unneeded variable and potential conversion issues in SCIOCCOMMAND code before calling physio. Similar to what NetBSD does. Fixes cdda2wav vs "Billie Holiday - Songs for Distingue Lovers" problem noted by Alexandre Ratchov. Tested by Alexandre. ok marco@ pedro@ deraadt@ mickey@
Diffstat (limited to 'sys/scsi/scsi_ioctl.c')
-rw-r--r--sys/scsi/scsi_ioctl.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index 6c6f0d3e6b9..c20b33f5086 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.21 2005/10/10 20:06:11 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.22 2005/12/08 14:02:47 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -378,18 +378,16 @@ scsi_do_ioctl( struct scsi_link *sc_link, dev_t dev, u_long cmd, caddr_t addr,
case SCIOCCOMMAND: {
scsireq_t *screq = (scsireq_t *)addr;
struct scsi_ioctl *si;
- int len;
si = si_get();
si->si_screq = *screq;
si->si_sc_link = sc_link;
- len = screq->datalen;
- if (len) {
+ if (screq->datalen) {
si->si_iov.iov_base = screq->databuf;
- si->si_iov.iov_len = len;
+ si->si_iov.iov_len = screq->datalen;
si->si_uio.uio_iov = &si->si_iov;
si->si_uio.uio_iovcnt = 1;
- si->si_uio.uio_resid = len;
+ si->si_uio.uio_resid = screq->datalen;
si->si_uio.uio_offset = 0;
si->si_uio.uio_segflg = UIO_USERSPACE;
si->si_uio.uio_rw =