From 5bb7dc4e050b79390037a931681c6fbce639a052 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Tue, 22 Jun 2021 15:21:46 +0200 Subject: [PATCH] cbfstool/cbfs-mkstage.c: Change signature of parse_elf_to_xip_stage() The dereferced parameter is never updated so passing a copy would work too. Change-Id: Ie36f64f55d4fc7034780116c28aaed65aa304d5e Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/55792 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- util/cbfstool/cbfs-mkstage.c | 4 ++-- util/cbfstool/cbfstool.c | 2 +- util/cbfstool/common.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c index 68eb641bfc..7f4a38bef6 100644 --- a/util/cbfstool/cbfs-mkstage.c +++ b/util/cbfstool/cbfs-mkstage.c @@ -260,7 +260,7 @@ static int rmod_filter(struct reloc_filter *f, const Elf64_Rela *r) } int parse_elf_to_xip_stage(const struct buffer *input, struct buffer *output, - uint32_t *location, const char *ignore_section, + uint32_t location, const char *ignore_section, struct cbfs_file_attr_stageheader *stageheader) { struct xip_context xipctx; @@ -310,7 +310,7 @@ int parse_elf_to_xip_stage(const struct buffer *input, struct buffer *output, /* Single loadable segment. The entire segment moves to final * location from based on virtual address of loadable segment. */ - adjustment = *location - pelf->phdr->p_vaddr; + adjustment = location - pelf->phdr->p_vaddr; DEBUG("Relocation adjustment: %08x\n", adjustment); fill_cbfs_stageheader(stageheader, diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 6133536b4b..48c9387b8f 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -1131,7 +1131,7 @@ static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset, **/ *offset = convert_addr_space(param.image_region, *offset); - ret = parse_elf_to_xip_stage(buffer, &output, offset, + ret = parse_elf_to_xip_stage(buffer, &output, *offset, param.ignore_section, stageheader); } else { diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h index 479fd713dd..1c25a66a68 100644 --- a/util/cbfstool/common.h +++ b/util/cbfstool/common.h @@ -178,7 +178,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output, struct cbfs_file_attr_stageheader *stageheader); /* location is TOP aligned. */ int parse_elf_to_xip_stage(const struct buffer *input, struct buffer *output, - uint32_t *location, const char *ignore_section, + uint32_t location, const char *ignore_section, struct cbfs_file_attr_stageheader *stageheader); void print_supported_architectures(void);