@@ -1004,7 +1004,8 @@ void pxe_menu_uninit(struct pxe_menu *cfg)
free(cfg);
}
-struct pxe_menu *parse_pxefile(struct pxe_context *ctx, unsigned long menucfg)
+struct pxe_menu *parse_pxefile(struct pxe_context *ctx, unsigned long menucfg,
+ ulong size)
{
struct pxe_menu *cfg;
char *buf;
@@ -1014,7 +1015,7 @@ struct pxe_menu *parse_pxefile(struct pxe_context *ctx, unsigned long menucfg)
if (!cfg)
return NULL;
- buf = map_sysmem(menucfg, 0);
+ buf = map_sysmem(menucfg, size);
r = parse_pxefile_top(ctx, buf, menucfg, cfg, 1);
unmap_sysmem(buf);
@@ -1306,7 +1307,7 @@ static struct pxe_menu *pxe_prepare(struct pxe_context *ctx,
struct pxe_menu *cfg;
int ret;
- cfg = parse_pxefile(ctx, pxefile_addr_r);
+ cfg = parse_pxefile(ctx, pxefile_addr_r, ctx->pxe_file_size);
if (!cfg) {
printf("Error parsing config file\n");
return NULL;
@@ -299,10 +299,12 @@ void handle_pxe_menu(struct pxe_context *ctx, struct pxe_menu *cfg);
*
* @ctx: PXE context (provided by the caller)
* @menucfg: Address of the PXE file in memory
+ * @size: Size of file in bytes
* Return: NULL on error, otherwise a pointer to a pxe_menu struct. Use
* pxe_menu_uninit() to free it.
*/
-struct pxe_menu *parse_pxefile(struct pxe_context *ctx, ulong menucfg);
+struct pxe_menu *parse_pxefile(struct pxe_context *ctx, ulong menucfg,
+ ulong size);
/**
* pxe_process_includes() - Process include files in a parsed menu
@@ -161,7 +161,7 @@ static int pxe_test_parse_norun(struct unit_test_state *uts)
ut_asserteq(1, ret); /* get_pxe_file returns 1 on success */
/* Parse the config file */
- cfg = parse_pxefile(&ctx, addr);
+ cfg = parse_pxefile(&ctx, addr, ctx.pxe_file_size);
ut_assertnonnull(cfg);
/* Process any include files */
@@ -465,7 +465,7 @@ static int pxe_test_fdtdir_norun(struct unit_test_state *uts)
/* Read and parse the config file */
ut_asserteq(1, get_pxe_file(&ctx, cfg_path, addr));
- cfg = parse_pxefile(&ctx, addr);
+ cfg = parse_pxefile(&ctx, addr, ctx.pxe_file_size);
ut_assertnonnull(cfg);
/* Consume parsing output */
@@ -574,7 +574,7 @@ static int pxe_test_errors_norun(struct unit_test_state *uts)
/* Read and parse the config file */
ut_asserteq(1, get_pxe_file(&ctx, cfg_path, addr));
- cfg = parse_pxefile(&ctx, addr);
+ cfg = parse_pxefile(&ctx, addr, ctx.pxe_file_size);
ut_assertnonnull(cfg);
/* Consume parsing output */
@@ -693,7 +693,7 @@ static int pxe_test_overlay_no_addr_norun(struct unit_test_state *uts)
ctx.quiet = true;
ut_asserteq(1, get_pxe_file(&ctx, cfg_path, addr));
- cfg = parse_pxefile(&ctx, addr);
+ cfg = parse_pxefile(&ctx, addr, ctx.pxe_file_size);
ut_assertnonnull(cfg);
/* Process any include files */
@@ -1268,7 +1268,7 @@ static int pxe_test_fit_embedded_fdt_norun(struct unit_test_state *uts)
/* Read and parse the config file */
ut_asserteq(1, get_pxe_file(&ctx, cfg_path, addr));
- cfg = parse_pxefile(&ctx, addr);
+ cfg = parse_pxefile(&ctx, addr, ctx.pxe_file_size);
ut_assertnonnull(cfg);
/* Consume parsing output */