+// SPDX-License-Identifier: GPL-2.0+
/*
*
- * SPDX-License-Identifier: GPL-2.0+
- *
* The following Boot Header format/structures and values are defined in the
* following documents:
* * Xilinx Zynq-7000 Technical Reference Manual (Section 6.3)
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)
}
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", ®init.address, ®init.data);