MLK-20663 imx8: Fix malloc issue in container parser
authorYe Li <ye.li@nxp.com>
Thu, 27 Dec 2018 05:42:24 +0000 (21:42 -0800)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 10:38:42 +0000 (03:38 -0700)
The size used for malloc is wrong, the following read function will
read 1KB to the container header buffer not the size of the header.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit cedcc6634ba143f665bf5dac3926b1b74a403479)

arch/arm/mach-imx/imx8/parser.c

index 998c7d6..68cf17e 100644 (file)
@@ -158,7 +158,7 @@ static int read_auth_container(struct spl_image_info *spl_image)
        int ret;
        int i;
 
-       container = malloc(sizeof(struct container_hdr));
+       container = malloc(CONTAINER_HDR_ALIGNMENT);
        if (!container)
                return -ENOMEM;