Coverity CID 1133: Abort quickly if we don't have a buffer in all the cases.

This commit is contained in:
christos 2006-04-14 16:31:27 +00:00
parent cd2eb11f45
commit 2fa8f13ac7
1 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhci.c,v 1.194 2006/03/31 17:31:13 christos Exp $ */
/* $NetBSD: uhci.c,v 1.195 2006/04/14 16:31:27 christos Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.194 2006/03/31 17:31:13 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.195 2006/04/14 16:31:27 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -3215,6 +3215,8 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer)
break;
case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
DPRINTFN(2,("uhci_root_ctrl_control wValue=0x%04x\n", value));
if (len == 0)
break;
switch(value >> 8) {
case UDESC_DEVICE:
if ((value & 0xff) != 0) {
@ -3244,8 +3246,6 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer)
memcpy(buf, &uhci_endpd, l);
break;
case UDESC_STRING:
if (len == 0)
break;
*(u_int8_t *)buf = 0;
totlen = 1;
switch (value & 0xff) {
@ -3380,6 +3380,8 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer)
}
break;
case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
if (len == 0)
break;
if ((value & 0xff) != 0) {
err = USBD_IOERROR;
goto ret;