summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1998-02-22 00:51:47 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1998-02-22 00:51:47 +0000
commit6b6bcb3cf87e5918fc8a35db21d6a89c2e0d07db (patch)
tree72d8849f2b06f57d1229497789f155d8f5728eba
parent8f109f3368e89a8e493354ff2da7a73ee329399c (diff)
Detect and report a weird error case (residual > request)
-rw-r--r--sys/scsi/st.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 0de6db3a929..3fec37555d7 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.23 1998/02/16 06:06:38 deraadt Exp $ */
+/* $OpenBSD: st.c,v 1.24 1998/02/22 00:51:46 niklas Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -1802,7 +1802,18 @@ st_interpret_sense(xs)
printf("%s: %d-byte record too big\n",
st->sc_dev.dv_xname,
xs->datalen - info);
- return EIO;
+ return (EIO);
+ } else if (info > xs->datalen) {
+ /*
+ * huh? the residual is bigger than the request
+ */
+ if ((xs->flags & SCSI_SILENT) == 0) {
+ printf(
+ "%s: bad residual %d out of %d\n",
+ st->sc_dev.dv_xname, info,
+ xs->datalen);
+ return (EIO);
+ }
}
xs->resid = info;
if (bp)