diff options
author | 1998-02-22 00:51:46 +0000 | |
---|---|---|
committer | 1998-02-22 00:51:46 +0000 | |
commit | f0fa915190bb533b804a561f81d5afa45c61eeaf (patch) | |
tree | ee124edcb38af77dc2dcc4efffbc7b6aa0b393ef | |
parent | Please GCC 2.8 -Wall (diff) | |
download | wireguard-openbsd-f0fa915190bb533b804a561f81d5afa45c61eeaf.tar.xz wireguard-openbsd-f0fa915190bb533b804a561f81d5afa45c61eeaf.zip |
Detect and report a weird error case (residual > request)
-rw-r--r-- | sys/scsi/st.c | 15 |
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) |