@@ -709,11 +709,6 @@ static const struct proc_ops vmcore_proc_ops = {
709
709
.proc_mmap = mmap_vmcore ,
710
710
};
711
711
712
- static struct vmcore_range * __init get_new_element (void )
713
- {
714
- return kzalloc (sizeof (struct vmcore_range ), GFP_KERNEL );
715
- }
716
-
717
712
static u64 get_vmcore_size (size_t elfsz , size_t elfnotesegsz ,
718
713
struct list_head * vc_list )
719
714
{
@@ -1116,7 +1111,6 @@ static int __init process_ptload_program_headers_elf64(char *elfptr,
1116
1111
size_t elfnotes_sz ,
1117
1112
struct list_head * vc_list )
1118
1113
{
1119
- struct vmcore_range * new ;
1120
1114
int i ;
1121
1115
Elf64_Ehdr * ehdr_ptr ;
1122
1116
Elf64_Phdr * phdr_ptr ;
@@ -1139,13 +1133,8 @@ static int __init process_ptload_program_headers_elf64(char *elfptr,
1139
1133
end = roundup (paddr + phdr_ptr -> p_memsz , PAGE_SIZE );
1140
1134
size = end - start ;
1141
1135
1142
- /* Add this contiguous chunk of memory to vmcore list.*/
1143
- new = get_new_element ();
1144
- if (!new )
1136
+ if (vmcore_alloc_add_range (vc_list , start , size ))
1145
1137
return - ENOMEM ;
1146
- new -> paddr = start ;
1147
- new -> size = size ;
1148
- list_add_tail (& new -> list , vc_list );
1149
1138
1150
1139
/* Update the program header offset. */
1151
1140
phdr_ptr -> p_offset = vmcore_off + (paddr - start );
@@ -1159,7 +1148,6 @@ static int __init process_ptload_program_headers_elf32(char *elfptr,
1159
1148
size_t elfnotes_sz ,
1160
1149
struct list_head * vc_list )
1161
1150
{
1162
- struct vmcore_range * new ;
1163
1151
int i ;
1164
1152
Elf32_Ehdr * ehdr_ptr ;
1165
1153
Elf32_Phdr * phdr_ptr ;
@@ -1182,13 +1170,8 @@ static int __init process_ptload_program_headers_elf32(char *elfptr,
1182
1170
end = roundup (paddr + phdr_ptr -> p_memsz , PAGE_SIZE );
1183
1171
size = end - start ;
1184
1172
1185
- /* Add this contiguous chunk of memory to vmcore list.*/
1186
- new = get_new_element ();
1187
- if (!new )
1173
+ if (vmcore_alloc_add_range (vc_list , start , size ))
1188
1174
return - ENOMEM ;
1189
- new -> paddr = start ;
1190
- new -> size = size ;
1191
- list_add_tail (& new -> list , vc_list );
1192
1175
1193
1176
/* Update the program header offset */
1194
1177
phdr_ptr -> p_offset = vmcore_off + (paddr - start );
0 commit comments