Jan Beulich writes ("Re: [PATCH] libelf: Fix div0 issues in 
elf_{shdr,phdr}_count()"):
> On 08.12.16 at 15:18, <andrew.coop...@citrix.com> wrote:
> > Spotted by Coverity.
> 
> And wrongly so, imo.
...
> > @@ -148,11 +154,17 @@ unsigned elf_shdr_count(struct elf_binary *elf)
> >  unsigned elf_phdr_count(struct elf_binary *elf)
> >  {
> >      unsigned count = elf_uval(elf, elf->ehdr, e_phnum);
> > +    unsigned entsize = elf_uval(elf, elf->ehdr, e_phentsize);
...
> ... this would end up being dead code, due to the checks the same
> patch you refer to introduced in elf_init().

I think I would prefer code that is obviously correct from local
inspection.  There is no performance implication here.

Maybe what we want is elf_divide() which implments anything/0 as 0.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to