tech-kern archive

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

re: patch: debug instrumentation for dev/raidframe/rf_netbsdkintf.c



On Tue, 22 Jan 2019, matthew green wrote:

@@ -472,6 +472,9 @@
 	const char *bootname = device_xname(bdv);
 	size_t len = strlen(bootname);

+	if (bdv == NULL)
+		return 0;
+

This looked suspicious, even before I read the code.

The question is if it is ever legitimate for bdv to be NULL.

infact, bdv has already been dereferenced at this point:
the assignment to bootname 3 lines up.

So, if we're going to insert a KASSERT() we would need to separate
the assignment from bootname's declaration, and do the assignment
after the KASSERT()


+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+


Home | Main Index | Thread Index | Old Index