svn commit: r346002 - head/stand/common
Author: tsoome Date: Sun Apr 7 12:20:17 2019 New Revision: 346002 URL: https://svnweb.freebsd.org/changeset/base/346002 Log: loader: mod_loadkld() error: we previously assumed 'last_file' could be null The last_file variable is used to reset the loadaddr variable back to original value; however, it is possible the last_file is NULL, so we can not blindly trust it. But then again, we can just save the original loadaddr and use the saved value for recovery. MFC after:1w Modified: head/stand/common/module.c Modified: head/stand/common/module.c == --- head/stand/common/module.c Sun Apr 7 12:10:19 2019(r346001) +++ head/stand/common/module.c Sun Apr 7 12:20:17 2019(r346002) @@ -559,9 +559,10 @@ mod_load(char *modname, struct mod_depend *verinfo, in int mod_loadkld(const char *kldname, int argc, char *argv[]) { - struct preloaded_file *fp, *last_file; - int err; + struct preloaded_file *fp; + int err; char*filename; + vm_offset_t loadaddr_saved; /* * Get fully qualified KLD name @@ -582,22 +583,19 @@ mod_loadkld(const char *kldname, int argc, char *argv[ free(filename); return (0); } - for (last_file = preloaded_files; -last_file != NULL && last_file->f_next != NULL; -last_file = last_file->f_next) - ; do { err = file_load(filename, loadaddr, ); if (err) break; fp->f_args = unargv(argc, argv); + loadaddr_saved = loadaddr; loadaddr = fp->f_addr + fp->f_size; file_insert_tail(fp); /* Add to the list of loaded files */ if (file_load_dependencies(fp) != 0) { err = ENOENT; last_file->f_next = NULL; - loadaddr = last_file->f_addr + last_file->f_size; + loadaddr = loadaddr_saved; fp = NULL; break; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346002 - head/stand/common
Author: tsoome Date: Sun Apr 7 12:20:17 2019 New Revision: 346002 URL: https://svnweb.freebsd.org/changeset/base/346002 Log: loader: mod_loadkld() error: we previously assumed 'last_file' could be null The last_file variable is used to reset the loadaddr variable back to original value; however, it is possible the last_file is NULL, so we can not blindly trust it. But then again, we can just save the original loadaddr and use the saved value for recovery. MFC after:1w Modified: head/stand/common/module.c Modified: head/stand/common/module.c == --- head/stand/common/module.c Sun Apr 7 12:10:19 2019(r346001) +++ head/stand/common/module.c Sun Apr 7 12:20:17 2019(r346002) @@ -559,9 +559,10 @@ mod_load(char *modname, struct mod_depend *verinfo, in int mod_loadkld(const char *kldname, int argc, char *argv[]) { - struct preloaded_file *fp, *last_file; - int err; + struct preloaded_file *fp; + int err; char*filename; + vm_offset_t loadaddr_saved; /* * Get fully qualified KLD name @@ -582,22 +583,19 @@ mod_loadkld(const char *kldname, int argc, char *argv[ free(filename); return (0); } - for (last_file = preloaded_files; -last_file != NULL && last_file->f_next != NULL; -last_file = last_file->f_next) - ; do { err = file_load(filename, loadaddr, ); if (err) break; fp->f_args = unargv(argc, argv); + loadaddr_saved = loadaddr; loadaddr = fp->f_addr + fp->f_size; file_insert_tail(fp); /* Add to the list of loaded files */ if (file_load_dependencies(fp) != 0) { err = ENOENT; last_file->f_next = NULL; - loadaddr = last_file->f_addr + last_file->f_size; + loadaddr = loadaddr_saved; fp = NULL; break; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"