]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r345998-r346002, r346007-r346008: various loader improvements
authorKyle Evans <kevans@FreeBSD.org>
Thu, 24 Oct 2019 02:36:42 +0000 (02:36 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Thu, 24 Oct 2019 02:36:42 +0000 (02:36 +0000)
commit9d09b0446d6c260539217eda9ae680e0548026de
tree9de1b9e271af661f9cf2425ac008522b8c535943
parent289d5703ab7e0bd831811030acd36063d9c998d1
MFC r345998-r346002, r346007-r346008: various loader improvements

r345998:
loader: malloc+bzero is calloc

Replace malloc+bzero in module.c with calloc.

r345999:
loader: file_addmodule should check for memory allocation

strdup() can return NULL.

r346000:
loader: remove pointer checks before free() in module.c

free() does check for NULL argument, remove duplicate checks.

r346001:
loader: file_addmetadata() should check for memory allocation

malloc() can return NULL.

r346002:
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.

r346007:
loader: add file_remove() function to undo file_insert_tail().

346002 did miss the fact that we do not only undo the loadaddr, but also
we need to remove the inserted module. Implement file_remove() to do the
job.

r346008:
loader: command_lsefi: ret can be used uninitialized
stand/common/module.c
stand/efi/loader/main.c