mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 14:48:57 +00:00
o avoid potential null ptr deref if symbol lookup fails
o unload module if symbol lookup fails Noticed by: Coverity Prevent analysis tool (null ptr deref) Reviewed by: bms, imp, dwhite
This commit is contained in:
parent
3b30e64d22
commit
d40b07dfe4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142506
@ -792,9 +792,13 @@ digi_loadmoduledata(struct digi_softc *sc)
|
||||
|
||||
sym = malloc(modlen + 10, M_TEMP, M_WAITOK);
|
||||
snprintf(sym, modlen + 10, "digi_mod_%s", sc->module);
|
||||
if ((symptr = linker_file_lookup_symbol(lf, sym, 0)) == NULL)
|
||||
printf("digi_%s.ko: Symbol `%s' not found\n", sc->module, sym);
|
||||
symptr = linker_file_lookup_symbol(lf, sym, 0);
|
||||
free(sym, M_TEMP);
|
||||
if (symptr == NULL) {
|
||||
printf("digi_%s.ko: Symbol `%s' not found\n", sc->module, sym);
|
||||
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
digi_mod = (struct digi_mod *)symptr;
|
||||
if (digi_mod->dm_version != DIGI_MOD_VERSION) {
|
||||
|
Loading…
Reference in New Issue
Block a user