zdump: dfo_elf: replace HDR_PER_CPU_SIZE with get_max_note_size_per_cpu

The maximum size of all supported ELF note entries for a CPU can be 0x4a4 bytes
and not 0x4a0. Use a function for the calculation so it's easier to maintain.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2022-09-01 20:09:48 +00:00
committed by Jan Höppner
parent d712806b39
commit dc87aef335
3 changed files with 25 additions and 4 deletions

View File

@@ -79,6 +79,9 @@
#define NOTE_NAME_VMCOREINFO "VMCOREINFO"
#define ELF_NOTE_ROUNDUP(size) ROUNDUP(size, 4)
#define ELF_NOTE_NAME_SIZE(name) ELF_NOTE_ROUNDUP(name ? strlen(name) + 1 : 0)
#define ELF64_NOTE_SIZE(name, desc_size) \
(sizeof(Elf64_Nhdr) + ELF_NOTE_NAME_SIZE(name) + ELF_NOTE_ROUNDUP(desc_size))
/*
* prstatus ELF Note
@@ -266,4 +269,6 @@ void *nt_prpsinfo(void *ptr);
*/
void *nt_vmcoreinfo(void *ptr, const char *vmcoreinfo);
size_t get_max_note_size_per_cpu(void);
#endif /* DF_ELF_H */