Commit 56c7e8015509312240b1ee15f2ff74510939a45d
tools: mkimage: Check if file is regular file
Current Makefile.spl passes -R parameter which is not empty and pointing to ./ folder. "./tools/mkimage -T zynqmpimage -R ./"" -d spl/u-boot-spl.bin spl/boot.bin" That's why mkimage is trying to parse ./ file and generate register init which is wrong. Check that passed filename is regular file. If not do not work with it. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Showing 1 changed file with 8 additions and 2 deletions Side-by-side Diff
... | ... | @@ -237,12 +237,18 @@ |
237 | 237 | static void zynqmpimage_parse_initparams(struct zynqmp_header *zynqhdr, |
238 | 238 | const char *filename) |
239 | 239 | { |
240 | - /* Expect a table of register-value pairs, e.g. "0x12345678 0x4321" */ | |
241 | - FILE *fp = fopen(filename, "r"); | |
240 | + FILE *fp; | |
242 | 241 | struct zynqmp_reginit reginit; |
243 | 242 | unsigned int reg_count = 0; |
244 | 243 | int r; |
244 | + struct stat path_stat; | |
245 | 245 | |
246 | + stat(filename, &path_stat); | |
247 | + if (!S_ISREG(path_stat.st_mode)) | |
248 | + return; | |
249 | + | |
250 | + /* Expect a table of register-value pairs, e.g. "0x12345678 0x4321" */ | |
251 | + fp = fopen(filename, "r"); | |
246 | 252 | if (!fp) { |
247 | 253 | fprintf(stderr, "Cannot open initparams file: %s\n", filename); |
248 | 254 | exit(1); |
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5
-
mentioned in commit 37a2cf
-
mentioned in commit ebe0f5