diff options
author | Doug Rabson <dfr@FreeBSD.org> | 2004-05-23 18:43:44 +0000 |
---|---|---|
committer | Doug Rabson <dfr@FreeBSD.org> | 2004-05-23 18:43:44 +0000 |
commit | 7b1f62860646317ac3f9d39056a1b450ea8e3692 (patch) | |
tree | 1974379cb9dcf0ca2ef51eb5d38724e7605a0f8a /sys | |
parent | 478fee28e697f4ee59dd9d2a510ff0ca39f74f4f (diff) | |
download | src-7b1f62860646317ac3f9d39056a1b450ea8e3692.tar.gz src-7b1f62860646317ac3f9d39056a1b450ea8e3692.zip |
Don't try to copy out the result payload if there isn't one. This ioctl
interface really needs changing to split out the various async request
types.
Notes
Notes:
svn path=/head/; revision=129628
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/firewire/fwdev.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 29c025b83da7..7cf7dc91a103 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -594,13 +594,21 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* copy response */ tinfo = &sc->fc->tcode[xfer->recv.hdr.mode.hdr.tcode]; - if (asyreq->req.len >= xfer->recv.pay_len + tinfo->hdr_len) - asyreq->req.len = xfer->recv.pay_len; - else - err = EINVAL; + if (xfer->recv.hdr.mode.hdr.tcode == FWTCODE_RRESB || + xfer->recv.hdr.mode.hdr.tcode == FWTCODE_LRES) { + pay_len = xfer->recv.pay_len; + if (asyreq->req.len >= xfer->recv.pay_len + tinfo->hdr_len) { + asyreq->req.len = xfer->recv.pay_len + + tinfo->hdr_len; + } else { + err = EINVAL; + pay_len = 0; + } + } else { + pay_len = 0; + } bcopy(&xfer->recv.hdr, fp, tinfo->hdr_len); - bcopy(xfer->recv.payload, (char *)fp + tinfo->hdr_len, - MAX(0, asyreq->req.len - tinfo->hdr_len)); + bcopy(xfer->recv.payload, (char *)fp + tinfo->hdr_len, pay_len); out: fw_xfer_free_buf(xfer); break; |