summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Chen <Raymond.Chen@Sun.COM>2010-05-11 10:18:59 +0800
committerRaymond Chen <Raymond.Chen@Sun.COM>2010-05-11 10:18:59 +0800
commit6847c243c8d8a90a8d64e720e19e1353c0cb9889 (patch)
treed3447beabc3a7236d248252b4b69757b268fb651
parent09af7b171f644af72732347ebe410256b25568c9 (diff)
downloadillumos-joyent-6847c243c8d8a90a8d64e720e19e1353c0cb9889.tar.gz
6949770 Uninitialized data in usbvc may cause trouble
-rw-r--r--usr/src/uts/common/io/usb/clients/video/usbvc/usbvc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr/src/uts/common/io/usb/clients/video/usbvc/usbvc.c b/usr/src/uts/common/io/usb/clients/video/usbvc/usbvc.c
index 243fcba732..c2bae40ba4 100644
--- a/usr/src/uts/common/io/usb/clients/video/usbvc/usbvc.c
+++ b/usr/src/uts/common/io/usb/clients/video/usbvc/usbvc.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
*/
@@ -2841,20 +2840,22 @@ usbvc_read_buf(usbvc_state_t *usbvcp, struct buf *bp)
buf_residue = buf->filled - buf->len_read;
len_to_copy = min(bp->b_bcount, buf_residue);
+ bcopy(buf->data + buf->len_read, bp->b_un.b_addr, len_to_copy);
+ bp->b_private = NULL;
+ buf->len_read += len_to_copy;
+ bp->b_resid = bp->b_bcount - len_to_copy;
+
if (len_to_copy == buf_residue) {
/*
* the bp can accommodate all the remaining bytes of
* the buf. Then we can reuse this buf.
*/
+ buf->len_read = 0;
list_remove(&usbvcp->usbvc_curr_strm->buf_read.uv_buf_done,
buf);
list_insert_tail(&usbvcp->usbvc_curr_strm->buf_read.uv_buf_free,
buf);
}
- bcopy(buf->data + buf->len_read, bp->b_un.b_addr, len_to_copy);
- bp->b_private = NULL;
- buf->len_read += len_to_copy;
- bp->b_resid = bp->b_bcount - len_to_copy;
return (USB_SUCCESS);
}