mirror of
https://github.com/dynup/kpatch
synced 2025-01-02 18:52:02 +00:00
Merge pull request #44 from jpoimboe/gcc-warnings
enable gcc warnings and fix all warnings
This commit is contained in:
commit
16fb78696c
@ -1,6 +1,6 @@
|
||||
include ../Makefile.inc
|
||||
|
||||
CFLAGS += -I../kmod/core
|
||||
CFLAGS += -I../kmod/core -Wall
|
||||
LDFLAGS = -lelf
|
||||
|
||||
TARGETS = create-diff-object add-patches-section link-vmlinux-syms
|
||||
|
@ -141,7 +141,7 @@ static void find_section_by_name(struct elf *elf, char *name, struct section *se
|
||||
GElf_Shdr sh;
|
||||
char *secname;
|
||||
|
||||
while (scn = elf_nextscn(elf->elf, scn)) {
|
||||
while ((scn = elf_nextscn(elf->elf, scn))) {
|
||||
if (!gelf_getshdr(scn, &sh))
|
||||
ERROR("gelf_getshdr");
|
||||
|
||||
@ -207,7 +207,6 @@ int main(int argc, char **argv)
|
||||
struct symlist symlist, symlistv;
|
||||
struct sym *cur, *vsym;
|
||||
struct elf elf, elfv;
|
||||
char name[255];
|
||||
void *buf;
|
||||
struct kpatch_patch *patches_data;
|
||||
GElf_Rela *relas_data;
|
||||
@ -252,7 +251,7 @@ int main(int argc, char **argv)
|
||||
cur->vm_addr = vsym->sym.st_value;
|
||||
cur->vm_len = vsym->sym.st_size;
|
||||
cur->action = PATCH;
|
||||
printf("original function at address %016lx (length %d)\n",
|
||||
printf("original function at address %016lx (length %zu)\n",
|
||||
cur->vm_addr, cur->vm_len);
|
||||
patches_nr++;
|
||||
}
|
||||
|
@ -428,7 +428,6 @@ struct kpatch_elf *kpatch_elf_open(const char *name)
|
||||
void kpatch_compare_correlated_nonrela_section(struct section *sec)
|
||||
{
|
||||
struct section *sec1 = sec, *sec2 = sec->twin;
|
||||
enum status status;
|
||||
|
||||
/* Compare section headers (must match or fatal) */
|
||||
if (sec1->sh.sh_type != sec2->sh.sh_type ||
|
||||
@ -666,8 +665,7 @@ void kpatch_correlate_elfs(struct kpatch_elf *kelf1, struct kpatch_elf *kelf2)
|
||||
void kpatch_compare_correlated_elements(struct kpatch_elf *kelf)
|
||||
{
|
||||
struct section *sec;
|
||||
struct rela *rela;
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
/* tables are already correlated at this point */
|
||||
kpatch_compare_correlated_nonrela_sections(&kelf->sections);
|
||||
@ -715,7 +713,7 @@ void kpatch_dump_kelf(struct kpatch_elf *kelf)
|
||||
printf(", base-> %s\n", sec->base->name);
|
||||
printf("rela section expansion\n");
|
||||
for_each_rela(j, rela, &sec->relas) {
|
||||
printf("sym %d, offset %d, type %d, %s %s %d %s\n",
|
||||
printf("sym %lu, offset %d, type %d, %s %s %d %s\n",
|
||||
GELF_R_SYM(rela->rela.r_info),
|
||||
rela->offset, rela->type,
|
||||
rela->sym->name,
|
||||
@ -1158,7 +1156,7 @@ void kpatch_create_symtab(struct kpatch_elf *kelf)
|
||||
|
||||
void kpatch_write_output_elf(struct kpatch_elf *kelf, Elf *elf, char *outfile)
|
||||
{
|
||||
int fd, i, index = 0;
|
||||
int fd, i;
|
||||
struct section *sec;
|
||||
Elf *elfout;
|
||||
GElf_Ehdr eh, ehout;
|
||||
|
@ -138,7 +138,7 @@ static void find_section_by_name(struct elf *elf, char *name, struct section *se
|
||||
GElf_Shdr sh;
|
||||
char *secname;
|
||||
|
||||
while (scn = elf_nextscn(elf->elf, scn)) {
|
||||
while ((scn = elf_nextscn(elf->elf, scn))) {
|
||||
if (!gelf_getshdr(scn, &sh))
|
||||
ERROR("gelf_getshdr");
|
||||
|
||||
@ -205,17 +205,9 @@ int main(int argc, char **argv)
|
||||
struct sym *cur, *vsym;
|
||||
struct elf elf, elfv;
|
||||
char name[255];
|
||||
void *buf;
|
||||
struct kpatch_patch *patches_data;
|
||||
GElf_Rela *relas_data;
|
||||
int patches_nr = 0, i, patches_size, relas_size, len;
|
||||
int patches_offset, relas_offset, patches_index, relas_index;
|
||||
struct section symtab;
|
||||
Elf_Scn *scn;
|
||||
Elf_Data *data;
|
||||
GElf_Shdr sh, *shp;
|
||||
GElf_Ehdr eh;
|
||||
GElf_Sym sym;
|
||||
|
||||
/* set elf version (required by libelf) */
|
||||
if (elf_version(EV_CURRENT) == EV_NONE)
|
||||
@ -280,7 +272,7 @@ int main(int argc, char **argv)
|
||||
cur->vm_addr = vsym->sym.st_value;
|
||||
cur->vm_len = vsym->sym.st_size;
|
||||
cur->action = LINK;
|
||||
printf("original symbol at address %016lx (length %d)\n",
|
||||
printf("original symbol at address %016lx (length %zu)\n",
|
||||
cur->vm_addr, cur->vm_len);
|
||||
}
|
||||
|
||||
@ -360,7 +352,6 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
find_section_by_name(&elf, ".symtab", &symtab);
|
||||
scn = symtab.scn;
|
||||
shp = &symtab.sh;
|
||||
|
||||
data = elf_getdata(scn, NULL);
|
||||
if (!data)
|
||||
|
Loading…
Reference in New Issue
Block a user