lkml.org 
[lkml]   [2015]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v2 4/6] livepatch: reuse module loader code to write relocations
On Thu, 10 Dec 2015, Minfei Huang wrote:

> > + klp_for_each_reloc_sec(obj, reloc_sec) {
> > + relindex = reloc_sec->index;
> > + num_relas = pmod->sechdrs[relindex].sh_size / sizeof(Elf_Rela);
> > + rela = (Elf_Rela *) pmod->sechdrs[relindex].sh_addr;
> > +
> > + /* For each rela in this __klp_rela section */
> > + for (i = 0; i < num_relas; i++, rela++) {
> > + sym = symtab + ELF_R_SYM(rela->r_info);
> > + symname = pmod->core_strtab + sym->st_name;
> > +
> > + if (sym->st_shndx == SHN_LIVEPATCH) {
> > + if (sym->st_info == 'K')
> > + ret = klp_find_external_symbol(pmod, symname, &addr);
> > + else
> > + ret = klp_find_object_symbol(obj->name, symname, &addr);
> > + if (ret)
> > + return ret;
> > + sym->st_value = addr;
> > + }
> > }
> > + ret = apply_relocate_add(pmod->sechdrs, pmod->core_strtab,
> > + pmod->index.sym, relindex, pmod);
>
> It is more appropiate to test the ret.

And if error is encountered ... then you'd propose to do what?

The code is correct as is; the return value is propagated properly to
caller, and all the existing callers have proper error handling.

--
Jiri Kosina
SUSE Labs



\
 
 \ /
  Last update: 2015-12-10 21:01    [W:0.107 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site