diff options
author | sam <sam@FreeBSD.org> | 2005-02-25 20:50:20 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2005-02-25 20:50:20 +0000 |
commit | c6ed41799443fa1c2fc2e700050bdf163c0cce83 (patch) | |
tree | a0a4e245cc14dca6bf688d09e3971fc6009e26e7 /sys/dev/digi | |
parent | 821f72c0a4bb040a2fbc72e5ff2dd6b5bfce86b9 (diff) | |
download | FreeBSD-src-c6ed41799443fa1c2fc2e700050bdf163c0cce83.zip FreeBSD-src-c6ed41799443fa1c2fc2e700050bdf163c0cce83.tar.gz |
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
Diffstat (limited to 'sys/dev/digi')
-rw-r--r-- | sys/dev/digi/digi.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 5ecc601..7f68c02 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -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) { |