mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-05 18:17:47 +07:00
x86/vdso/vdso2c: Convert iterators to unsigned
`i` and `j` are used everywhere with unsigned types. Convert `i` to unsigned long in order to avoid signed to unsigned comparisons. Convert `k` to unsigned int with the same purpose. Also, drop `j` as `i` could be used in place of it. Introduce syms_nr for readability. Co-developed-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Andy Lutomirski <luto@kernel.org> Link: https://lkml.kernel.org/r/20200420183256.660371-4-dima@arista.com
This commit is contained in:
parent
089ef5579f
commit
833e55bb99
@ -13,8 +13,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
||||
unsigned long load_size = -1; /* Work around bogus warning */
|
||||
unsigned long mapping_size;
|
||||
ELF(Ehdr) *hdr = (ELF(Ehdr) *)raw_addr;
|
||||
int i;
|
||||
unsigned long j;
|
||||
unsigned long i, syms_nr;
|
||||
ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr,
|
||||
*alt_sec = NULL;
|
||||
ELF(Dyn) *dyn = 0, *dyn_end = 0;
|
||||
@ -86,11 +85,10 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
||||
strtab_hdr = raw_addr + GET_LE(&hdr->e_shoff) +
|
||||
GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link);
|
||||
|
||||
syms_nr = GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
|
||||
/* Walk the symbol table */
|
||||
for (i = 0;
|
||||
i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
|
||||
i++) {
|
||||
int k;
|
||||
for (i = 0; i < syms_nr; i++) {
|
||||
unsigned int k;
|
||||
ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
|
||||
GET_LE(&symtab_hdr->sh_entsize) * i;
|
||||
const char *sym_name = raw_addr +
|
||||
@ -150,11 +148,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
||||
fprintf(outfile,
|
||||
"static unsigned char raw_data[%lu] __ro_after_init __aligned(PAGE_SIZE) = {",
|
||||
mapping_size);
|
||||
for (j = 0; j < stripped_len; j++) {
|
||||
if (j % 10 == 0)
|
||||
for (i = 0; i < stripped_len; i++) {
|
||||
if (i % 10 == 0)
|
||||
fprintf(outfile, "\n\t");
|
||||
fprintf(outfile, "0x%02X, ",
|
||||
(int)((unsigned char *)stripped_addr)[j]);
|
||||
(int)((unsigned char *)stripped_addr)[i]);
|
||||
}
|
||||
fprintf(outfile, "\n};\n\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user