hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/arch/x86/entry/vdso/vdso2c.h
....@@ -7,14 +7,13 @@
77
88 static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
99 void *stripped_addr, size_t stripped_len,
10
- FILE *outfile, const char *name)
10
+ FILE *outfile, const char *image_name)
1111 {
1212 int found_load = 0;
1313 unsigned long load_size = -1; /* Work around bogus warning */
1414 unsigned long mapping_size;
1515 ELF(Ehdr) *hdr = (ELF(Ehdr) *)raw_addr;
16
- int i;
17
- unsigned long j;
16
+ unsigned long i, syms_nr;
1817 ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr,
1918 *alt_sec = NULL;
2019 ELF(Dyn) *dyn = 0, *dyn_end = 0;
....@@ -86,18 +85,18 @@
8685 strtab_hdr = raw_addr + GET_LE(&hdr->e_shoff) +
8786 GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link);
8887
88
+ syms_nr = GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
8989 /* Walk the symbol table */
90
- for (i = 0;
91
- i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
92
- i++) {
93
- int k;
90
+ for (i = 0; i < syms_nr; i++) {
91
+ unsigned int k;
9492 ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
9593 GET_LE(&symtab_hdr->sh_entsize) * i;
96
- const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
97
- GET_LE(&sym->st_name);
94
+ const char *sym_name = raw_addr +
95
+ GET_LE(&strtab_hdr->sh_offset) +
96
+ GET_LE(&sym->st_name);
9897
9998 for (k = 0; k < NSYMS; k++) {
100
- if (!strcmp(name, required_syms[k].name)) {
99
+ if (!strcmp(sym_name, required_syms[k].name)) {
101100 if (syms[k]) {
102101 fail("duplicate symbol %s\n",
103102 required_syms[k].name);
....@@ -134,7 +133,7 @@
134133 if (syms[sym_vvar_start] % 4096)
135134 fail("vvar_begin must be a multiple of 4096\n");
136135
137
- if (!name) {
136
+ if (!image_name) {
138137 fwrite(stripped_addr, stripped_len, 1, outfile);
139138 return;
140139 }
....@@ -149,15 +148,15 @@
149148 fprintf(outfile,
150149 "static unsigned char raw_data[%lu] __ro_after_init __aligned(PAGE_SIZE) = {",
151150 mapping_size);
152
- for (j = 0; j < stripped_len; j++) {
153
- if (j % 10 == 0)
151
+ for (i = 0; i < stripped_len; i++) {
152
+ if (i % 10 == 0)
154153 fprintf(outfile, "\n\t");
155154 fprintf(outfile, "0x%02X, ",
156
- (int)((unsigned char *)stripped_addr)[j]);
155
+ (int)((unsigned char *)stripped_addr)[i]);
157156 }
158157 fprintf(outfile, "\n};\n\n");
159158
160
- fprintf(outfile, "const struct vdso_image %s = {\n", name);
159
+ fprintf(outfile, "const struct vdso_image %s = {\n", image_name);
161160 fprintf(outfile, "\t.data = raw_data,\n");
162161 fprintf(outfile, "\t.size = %lu,\n", mapping_size);
163162 if (alt_sec) {