From 782cbe6f7df81a45f213a5e4d5be3904ef040b5e Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Wed, 12 May 2021 17:42:00 -0600 Subject: [PATCH] loader: Handle OOM in loader_phys_dev_ext_gpa Removing some dead code revealed a case where a potencial OOM situation was not being handled. Change-Id: Ibc5ad607f6adc0f590f663ab928c1abca6732d96 --- loader/loader.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loader/loader.c b/loader/loader.c index ab50f725..cd7c63ff 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -4329,12 +4329,12 @@ bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, idx = murmurhash(funcName, strlen(funcName), seed) % MAX_NUM_UNKNOWN_EXTS; if (perform_checking && !loader_name_in_phys_dev_ext_table(inst, &idx, funcName)) { uint32_t i; - bool added = false; // Only need to add first one to get index in Instance. Others will use // the same index. - if (!added && loader_add_phys_dev_ext_table(inst, &idx, funcName)) { - added = true; + if (!loader_add_phys_dev_ext_table(inst, &idx, funcName)) { + // couldn't perform the above function due to insufficient memory available + goto out; } // Setup the ICD function pointers -- 2.34.1