]> git.sur5r.net Git - u-boot/blobdiff - tools/zynqimage.c
efi_loader: ImageSize must be multiple of SectionAlignment
[u-boot] / tools / zynqimage.c
index b47132b02a60f4441bcf1205213da6a08324163f..aa003a7543b65d99fb0fdd8a81db34f5bc9eabb1 100644 (file)
@@ -147,6 +147,12 @@ static int zynqimage_verify_header(unsigned char *ptr, int image_size,
        if (image_size < sizeof(struct zynq_header))
                return -1;
 
+       if (zynqhdr->__reserved1 != 0)
+               return -1;
+
+       if (zynqhdr->__reserved2 != 0)
+               return -1;
+
        if (zynqhdr->width_detection != HEADER_WIDTHDETECTION)
                return -1;
        if (zynqhdr->image_identifier != HEADER_IMAGEIDENTIFIER)
@@ -239,11 +245,15 @@ static void zynqimage_parse_initparams(struct zynq_header *zynqhdr,
        }
 
        err = fstat(fileno(fp), &path_stat);
-       if (err)
+       if (err) {
+               fclose(fp);
                return;
+       }
 
-       if (!S_ISREG(path_stat.st_mode))
+       if (!S_ISREG(path_stat.st_mode)) {
+               fclose(fp);
                return;
+       }
 
        do {
                r = fscanf(fp, "%x %x", &reginit.address, &reginit.data);