Module Name: src Committed By: maya Date: Wed Oct 23 01:03:36 UTC 2019
Modified Files: src/sys/dev/usb: uvideo.c Log Message: Check if size is zero, too. PR kern/53734 To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/usb/uvideo.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/uvideo.c diff -u src/sys/dev/usb/uvideo.c:1.50 src/sys/dev/usb/uvideo.c:1.51 --- src/sys/dev/usb/uvideo.c:1.50 Wed Oct 23 00:52:39 2019 +++ src/sys/dev/usb/uvideo.c Wed Oct 23 01:03:36 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvideo.c,v 1.50 2019/10/23 00:52:39 maya Exp $ */ +/* $NetBSD: uvideo.c,v 1.51 2019/10/23 01:03:36 maya Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.50 2019/10/23 00:52:39 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.51 2019/10/23 01:03:36 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -999,7 +999,7 @@ static usbd_status uvideo_unit_alloc_controls(struct uvideo_unit *vu, uint8_t size, const uint8_t *controls) { - if (vu->vu_controls == 0) + if ((vu->vu_controls == 0) || (size == 0)) return USBD_INVAL; vu->vu_controls = kmem_alloc(sizeof(*vu->vu_controls) * size, KM_SLEEP);