diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2020-12-10 12:21:52 +0100 |
---|---|---|
committer | Paul Fagerburg <pfagerburg@chromium.org> | 2020-12-11 19:15:25 +0000 |
commit | 5446bdb270be409eaf5a0a60d86ebeb2ec4358ad (patch) | |
tree | 003640a1a25237ef762867d4db0aa11bc85c25d2 | |
parent | 71f639f123df43263fec0e0024ea07f257abeb50 (diff) |
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>
-rw-r--r-- | src/lib/fmap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/fmap.c b/src/lib/fmap.c index 2abe138cdd..418e715b3e 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -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; |