Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb umb(4): Use usb_cdc_descriptor_t for bDescriptor...



details:   https://anonhg.NetBSD.org/src/rev/3c562f3e45a1
branches:  trunk
changeset: 365279:3c562f3e45a1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 17 13:15:27 2022 +0000

description:
umb(4): Use usb_cdc_descriptor_t for bDescriptorSubtype.

Note: This needs more length validation!  TBD in a separate commit.

diffstat:

 sys/dev/usb/if_umb.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r ed5a1d186441 -r 3c562f3e45a1 sys/dev/usb/if_umb.c
--- a/sys/dev/usb/if_umb.c      Sun Apr 17 13:15:15 2022 +0000
+++ b/sys/dev/usb/if_umb.c      Sun Apr 17 13:15:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_umb.c,v 1.21 2021/09/21 14:49:01 christos Exp $ */
+/*     $NetBSD: if_umb.c,v 1.22 2022/04/17 13:15:27 riastradh Exp $ */
 /*     $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.21 2021/09/21 14:49:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.22 2022/04/17 13:15:27 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -297,6 +297,7 @@
        usbd_status status;
        usbd_desc_iter_t iter;
        const usb_descriptor_t *desc;
+       const usb_cdc_descriptor_t *csdesc;
        int      v;
        const usb_cdc_union_descriptor_t *ud;
        const struct mbim_descriptor *md;
@@ -350,7 +351,8 @@
                        continue;
                if (desc->bDescriptorType != UDESC_CS_INTERFACE)
                        continue;
-               switch (desc->bDescriptorSubtype) {
+               csdesc = (const usb_cdc_descriptor_t *)desc;
+               switch (csdesc->bDescriptorSubtype) {
                case UDESCSUB_CDC_UNION:
                        ud = (const usb_cdc_union_descriptor_t *)desc;
                        data_ifaceno = ud->bSlaveInterface[0];



Home | Main Index | Thread Index | Old Index