> >>> @@ -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()
i am not a huge fan of KASSERT(ptr != NULL). page fault is pretty much just as clear as the assert, and does not need special code to handle it. that said, i do see some utility in it as a guide to others reading this code, and won't object to this usage. .mrg.