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:
parent
71f639f123
commit
5446bdb270
|
@ -164,6 +164,9 @@ int fmap_locate_area(const char *name, struct region *ar)
|
||||||
struct region_device fmrd;
|
struct region_device fmrd;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
|
||||||
|
if (name == NULL || ar == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (find_fmap_directory(&fmrd))
|
if (find_fmap_directory(&fmrd))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -206,6 +209,9 @@ int fmap_find_region_name(const struct region * const ar,
|
||||||
struct region_device fmrd;
|
struct region_device fmrd;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
|
||||||
|
if (name == NULL || ar == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (find_fmap_directory(&fmrd))
|
if (find_fmap_directory(&fmrd))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue