[U-Boot] [RFC PATCH v2 18/20] fastboot: Check if part_name is NULL before using it

Alex Kiernan alex.kiernan at gmail.com
Mon Apr 30 08:32:52 UTC 2018


If we don't have a partition name passed, report it as not found.

Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
---

Changes in v2: None

 drivers/fastboot/fb_getvar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index 7989a19..cc74bab 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -66,7 +66,8 @@ void fb_getvar(char *cmd_parameter, char *response)
 		dev_desc = blk_get_dev("mmc", 0);
 		if (!dev_desc) {
 			fastboot_fail("block device not found", response);
-		} else if (part_get_info_by_name(dev_desc, part_name,
+		} else if (!part_name ||
+			   part_get_info_by_name(dev_desc, part_name,
 						 &part_info) < 0) {
 			fastboot_fail("partition not found", response);
 		} else if (!strcmp_l1("partition-type", cmd_parameter)) {
-- 
2.7.4



More information about the U-Boot mailing list