Simon Horman <horms at verge.net.au> writes: > This test appears bogus because the e_phnum element of Elf32_Phdr and > is an unsigned 16bit entity. The test is a basic sanity check, that apparently can never fail. So I see no harm in removing it. Reviewed-by: "Eric W. Biederman" <ebiederm at xmission.com> > This addresses the following warnings: > > vmcore-dmesg/vmcore-dmesg.c: In function 'read_elf32': > vmcore-dmesg/vmcore-dmesg.c:116: warning: comparison is always false due to limited range of data type > vmcore-dmesg/vmcore-dmesg.c: In function ?read_elf64?: > vmcore-dmesg/vmcore-dmesg.c:192: warning: comparison is always false due to limited range of data type > > Cc: Eric W. Biederman <ebiederm at xmission.com> > Signed-off-by: Simon Horman <horms at verge.net.au> > --- > vmcore-dmesg/vmcore-dmesg.c | 8 -------- > 1 files changed, 0 insertions(+), 8 deletions(-) > > diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c > index 7015894..365e293 100644 > --- a/vmcore-dmesg/vmcore-dmesg.c > +++ b/vmcore-dmesg/vmcore-dmesg.c > @@ -113,10 +113,6 @@ static void read_elf32(int fd) > ehdr.e_phentsize, sizeof(Elf32_Phdr)); > exit(12); > } > - if (ehdr.e_phnum > ULONG_MAX/sizeof(Elf64_Phdr)) { > - fprintf(stderr, "Too many elf program header entries\n"); > - exit(13); > - } > phdrs32_size = ehdr.e_phnum * sizeof(Elf32_Phdr); > phdrs_size = ehdr.e_phnum * sizeof(Elf64_Phdr); > phdr32 = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr)); > @@ -189,10 +185,6 @@ static void read_elf64(int fd) > ehdr.e_phentsize, sizeof(Elf64_Phdr)); > exit(12); > } > - if (ehdr.e_phnum > ULONG_MAX/sizeof(Elf64_Phdr)) { > - fprintf(stderr, "Too many program header entries\n"); > - exit(13); > - } > phdrs_size = ehdr.e_phnum * sizeof(Elf64_Phdr); > phdr64 = calloc(ehdr.e_phnum, sizeof(Elf64_Phdr)); > if (!phdr64) {