From 885a9774ef469666854a0e4bed7c33733d0396c7 Mon Sep 17 00:00:00 2001 From: Bernie Thompson Date: Tue, 17 Jan 2012 13:58:16 -0800 Subject: Add a failure check to ReadFdtBlock in ReadFdtPlatformFamily This adds in logic to check that ReadFdtBlock within ReadFdtPlatformFamily succeeded, returning NULL on failure. BUG=None TEST=Manual, run crossystem on an ARM system without a valid compatible FDT entry and ensure (error) is returned for platform_family. Change-Id: I6351292ff73e4bc08b028f85e72ccfe62159194a Reviewed-on: https://gerrit.chromium.org/gerrit/14321 Reviewed-by: Olof Johansson Reviewed-by: Bernie Thompson Tested-by: Bernie Thompson Commit-Ready: Bernie Thompson --- host/arch/arm/lib/crossystem_arch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c index 62cf31f6..305fddf3 100644 --- a/host/arch/arm/lib/crossystem_arch.c +++ b/host/arch/arm/lib/crossystem_arch.c @@ -165,7 +165,8 @@ static char * ReadFdtPlatformFamily(void) { size_t size = 0; int slen; - ReadFdtBlock(FDT_COMPATIBLE_PATH, &compat, &size); + if(ReadFdtBlock(FDT_COMPATIBLE_PATH, &compat, &size)) + return NULL; if (size > 0) compat[size-1] = 0; -- cgit v1.2.1