Module Name: src Committed By: bouyer Date: Sat Mar 17 11:45:00 UTC 2012
Modified Files: src/sys/dev/usb: ehci.c Log Message: Always check index against array bound; keep only the printf under DIAGNOSTIC. Suggested by matthew green To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/sys/dev/usb/ehci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/ehci.c diff -u src/sys/dev/usb/ehci.c:1.188 src/sys/dev/usb/ehci.c:1.189 --- src/sys/dev/usb/ehci.c:1.188 Thu Mar 15 18:38:37 2012 +++ src/sys/dev/usb/ehci.c Sat Mar 17 11:45:00 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.188 2012/03/15 18:38:37 bouyer Exp $ */ +/* $NetBSD: ehci.c,v 1.189 2012/03/17 11:45:00 bouyer Exp $ */ /* * Copyright (c) 2004-2008 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.188 2012/03/15 18:38:37 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.189 2012/03/17 11:45:00 bouyer Exp $"); #include "ohci.h" #include "uhci.h" @@ -2712,12 +2712,12 @@ ehci_alloc_sqtd_chain(struct ehci_pipe * ehci_physaddr_t a = dataphys + i * EHCI_PAGE_SIZE; if (i != 0) /* use offset only in first buffer */ a = EHCI_PAGE(a); -#ifdef DIAGNOSTIC if (i >= EHCI_QTD_NBUFFERS) { +#ifdef DIAGNOSTIC printf("ehci_alloc_sqtd_chain: i=%d\n", i); +#endif goto nomem; } -#endif cur->qtd.qtd_buffer[i] = htole32(a); cur->qtd.qtd_buffer_hi[i] = 0; }