Module Name:    src
Committed By:   riastradh
Date:           Sun May 23 08:42:47 UTC 2021

Modified Files:
        src/sys/dev/usb: umass.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/dev/usb/umass.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/umass.c
diff -u src/sys/dev/usb/umass.c:1.184 src/sys/dev/usb/umass.c:1.185
--- src/sys/dev/usb/umass.c:1.184	Mon Apr 13 09:26:43 2020
+++ src/sys/dev/usb/umass.c	Sun May 23 08:42:47 2021
@@ -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 @@ umass_bbb_transfer(struct umass_softc *s
 	    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 @@ umass_cbi_transfer(struct umass_softc *s
 	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);

Reply via email to