Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Not a bug strictly speaking, but compute the add...
details: https://anonhg.NetBSD.org/src/rev/7628cbadbbd9
branches: trunk
changeset: 461157:7628cbadbbd9
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Nov 17 11:28:48 2019 +0000
description:
Not a bug strictly speaking, but compute the address only after the length
checks, for clarity and to appease kUBSan.
diffstat:
sys/dev/usb/vhci.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (51 lines):
diff -r 81c95055fb1c -r 7628cbadbbd9 sys/dev/usb/vhci.c
--- a/sys/dev/usb/vhci.c Sun Nov 17 08:21:25 2019 +0000
+++ b/sys/dev/usb/vhci.c Sun Nov 17 11:28:48 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vhci.c,v 1.3 2019/10/03 05:13:23 maxv Exp $ */
+/* $NetBSD: vhci.c,v 1.4 2019/11/17 11:28:48 maxv Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.3 2019/10/03 05:13:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.4 2019/11/17 11:28:48 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -376,8 +376,6 @@
value = UGETW(req->wValue);
index = UGETW(req->wIndex);
- port = &sc->sc_port[VHCI_INDEX2PORT(index)];
-
#define C(x,y) ((x) | ((y) << 8))
switch (C(req->bRequest, req->bmRequestType)) {
case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
@@ -414,6 +412,7 @@
if (index < 1 || index >= sc->sc_nports) {
return -1;
}
+ port = &sc->sc_port[VHCI_INDEX2PORT(index)];
port->status |= UPS_C_PORT_RESET;
break;
case UHF_PORT_POWER:
@@ -430,6 +429,7 @@
if (index < 1 || index >= sc->sc_nports) {
return -1;
}
+ port = &sc->sc_port[VHCI_INDEX2PORT(index)];
switch (value) {
case UHF_PORT_ENABLE:
port->status &= ~UPS_PORT_ENABLED;
@@ -463,6 +463,7 @@
if (index < 1 || index >= sc->sc_nports) {
return -1;
}
+ port = &sc->sc_port[VHCI_INDEX2PORT(index)];
USETW(ps.wPortStatus, port->status);
USETW(ps.wPortChange, port->change);
totlen = uimin(len, sizeof(ps));
Home |
Main Index |
Thread Index |
Old Index