Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb umass(4): Assert that we got a cb up front.



details:   https://anonhg.NetBSD.org/src/rev/56f4226baedb
branches:  trunk
changeset: 1021280:56f4226baedb
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun May 23 08:42:47 2021 +0000

description:
umass(4): Assert that we got a cb up front.

Avoids jump to zero waaaaaaay down the line where we've forgotten why
we wanted to jump into oblivion.

diffstat:

 sys/dev/usb/umass.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 4f40e59db570 -r 56f4226baedb sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c       Sun May 23 08:42:32 2021 +0000
+++ b/sys/dev/usb/umass.c       Sun May 23 08:42:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umass.c,v 1.184 2020/04/13 09:26:43 jdolecek Exp $     */
+/*     $NetBSD: umass.c,v 1.185 2021/05/23 08:42:47 riastradh Exp $    */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.184 2020/04/13 09:26:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.185 2021/05/23 08:42:47 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1177,6 +1177,7 @@
            sc, cb, priv, data, datalen, dir, timeout);
        static int dCBWtag = 42;        /* unique for CBW of transfer */
 
+       KASSERT(cb);
        DPRINTFM(UDMASS_BBB, "sc %#jx cmd=0x%02jx", (uintptr_t)sc,
            *(u_char *)cmd, 0, 0);
 
@@ -1708,6 +1709,7 @@
        DPRINTFM(UDMASS_CBI, "sc %#jx: cmd=0x%02jx, len=%jd",
             (uintptr_t)sc, *(u_char *)cmd, datalen, 0);
 
+       KASSERT(cb);
        KASSERTMSG(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
                   "sc->sc_wire == 0x%02x wrong for umass_cbi_transfer\n",
                   sc->sc_wire);



Home | Main Index | Thread Index | Old Index