Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Add a sanity check to the computed actual transf...



details:   https://anonhg.NetBSD.org/src/rev/00b6009640e2
branches:  trunk
changeset: 476398:00b6009640e2
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Sep 15 21:08:59 1999 +0000

description:
Add a sanity check to the computed actual transfer length.

diffstat:

 sys/dev/usb/usbdi.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r c7c52c0febaa -r 00b6009640e2 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Wed Sep 15 21:08:19 1999 +0000
+++ b/sys/dev/usb/usbdi.c       Wed Sep 15 21:08:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.42 1999/09/15 14:17:15 augustss Exp $      */
+/*     $NetBSD: usbdi.c,v 1.43 1999/09/15 21:08:59 augustss Exp $      */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -743,8 +743,16 @@
                pipe->running = 0;
 
        if (!(reqh->flags & USBD_NO_COPY) && reqh->actlen != 0 &&
-           usbd_reqh_isread(reqh))
+           usbd_reqh_isread(reqh)) {
+#ifdef DIAGNOSTIC
+               if (reqh->actlen > reqh->length) {
+                       printf("usb_transfer_complete: actlen > len %d > %d\n",
+                              reqh->actlen, reqh->length);
+                       reqh->actlen = reqh->length;
+               }
+#endif
                memcpy(reqh->buffer, KERNADDR(dmap), reqh->actlen);
+       }
 
        /* if we allocated the buffer in usbd_transfer() we free it here. */
        if (reqh->rqflags & URQ_AUTO_DMABUF) {



Home | Main Index | Thread Index | Old Index