From: Tom Rini Date: Fri, 28 Jun 2013 18:43:01 +0000 (-0400) Subject: spl_mmc.c: Detect missing kernel image in RAW MMC X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=e4c444b34b6ff6b347e552805ee89c48f85785bb;p=u-boot.git spl_mmc.c: Detect missing kernel image in RAW MMC Currently, we assume that if we can read from MMC correctly, we have found a valid image. This is not the case as an empty area will read just fine. Add a check for a valid IH_MAGIC. Signed-off-by: Tom Rini Reviewed-by: Peter Korsgaard --- diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index e369ce3975..f27b4c277b 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -13,6 +13,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -30,6 +31,9 @@ static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector) if (err == 0) goto end; + if (image_get_magic(header) != IH_MAGIC) + return -1; + spl_parse_image_header(header); /* convert size to sectors - round up */