lib/fmap: Add null parameters handling

Prevent null-pointer access when passed as parameter.

Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Change-Id: Ie712d040b1c2383dcc8884e5f779c3591ccf0163
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48531
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
This commit is contained in:
Jakub Czapiga 2020-12-10 12:21:52 +01:00 committed by Paul Fagerburg
parent 71f639f123
commit 5446bdb270
1 changed files with 6 additions and 0 deletions

View File

@ -164,6 +164,9 @@ int fmap_locate_area(const char *name, struct region *ar)
struct region_device fmrd;
size_t offset;
if (name == NULL || ar == NULL)
return -1;
if (find_fmap_directory(&fmrd))
return -1;
@ -206,6 +209,9 @@ int fmap_find_region_name(const struct region * const ar,
struct region_device fmrd;
size_t offset;
if (name == NULL || ar == NULL)
return -1;
if (find_fmap_directory(&fmrd))
return -1;