Re: [PATCH v7 2/8] vmcore: allocate buffer for ELF headers onpage-size alignment

From: Vivek Goyal
Date: Wed May 22 2013 - 10:02:39 EST


On Wed, May 22, 2013 at 11:55:43AM +0900, HATAYAMA Daisuke wrote:

[..]
> /* Sets offset fields of vmcore elements. */
> -static void __init set_vmcore_list_offsets_elf64(char *elfptr,
> +static void __init set_vmcore_list_offsets_elf64(char *elfptr, size_t elfsz,
> struct list_head *vc_list)
> {
> loff_t vmcore_off;
> @@ -469,8 +472,7 @@ static void __init set_vmcore_list_offsets_elf64(char *elfptr,
> ehdr_ptr = (Elf64_Ehdr *)elfptr;
>
> /* Skip Elf header and program headers. */
> - vmcore_off = sizeof(Elf64_Ehdr) +
> - (ehdr_ptr->e_phnum) * sizeof(Elf64_Phdr);
> + vmcore_off = elfsz;

As you are passing in size of elf headers, I think some of the code
has become redundant in this function. (ehdr_ptr = (Elf64_Ehdr *)elfptr;).
We can remove it and now we should be able to merge
set_vmcore_list_offsets_elf32() and set_vmcore_list_offsets_elf64()
functions.

Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/