[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libelf: Fix div0 issues in elf_{shdr, phdr}_count()
Jan Beulich writes ("Re: [PATCH] libelf: Fix div0 issues in elf_{shdr,phdr}_count()"): > On 08.12.16 at 15:18, <andrew.cooper3@xxxxxxxxxx> 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@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |