summaryrefslogtreecommitdiff
path: root/sys/dev/tws
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-01-12 17:00:54 +0000
committerMark Johnston <markj@FreeBSD.org>2019-01-12 17:00:54 +0000
commitb5154490a84443b3b8041c06ef7626789771b873 (patch)
tree47ac3a87d66a14524a01df9622e80af1fe06f1a7 /sys/dev/tws
parentba65586cdc3d45992d33ae490ee4652a26d99cb3 (diff)
Notes
Diffstat (limited to 'sys/dev/tws')
-rw-r--r--sys/dev/tws/tws_user.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/tws/tws_user.c b/sys/dev/tws/tws_user.c
index 5c93a4b93f78..f3eb09201ba6 100644
--- a/sys/dev/tws/tws_user.c
+++ b/sys/dev/tws/tws_user.c
@@ -90,9 +90,13 @@ tws_passthru(struct tws_softc *sc, void *buf)
struct tws_request *req;
struct tws_ioctl_no_data_buf *ubuf = (struct tws_ioctl_no_data_buf *)buf;
int error;
+ u_int32_t buffer_length;
u_int16_t lun4;
-
+ buffer_length = roundup2(ubuf->driver_pkt.buffer_length, 512);
+ if ( buffer_length > TWS_MAX_IO_SIZE ) {
+ return(EINVAL);
+ }
if ( tws_get_state(sc) != TWS_ONLINE) {
return(EBUSY);
}
@@ -116,7 +120,7 @@ tws_passthru(struct tws_softc *sc, void *buf)
}
} while(1);
- req->length = (ubuf->driver_pkt.buffer_length + 511) & ~511;
+ req->length = buffer_length;
TWS_TRACE_DEBUG(sc, "datal,rid", req->length, req->request_id);
if ( req->length ) {
req->data = sc->ioctl_data_mem;