correcting issues identified by coverity
Change-Id: I0bec297b2db36ddd70d754c90ab8396e0890d2ca Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
This commit is contained in:
parent
36605e6182
commit
50d24833b0
1 changed files with 16 additions and 4 deletions
|
@ -239,7 +239,10 @@ static int ehdrLoad(int fd)
|
|||
unsigned ix = 0x12345678; /* used to auto-detect endian-ness */
|
||||
size_t nBytes; /* number of bytes read from file */
|
||||
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
if (lseek(fd, 0, SEEK_SET) == -1) {
|
||||
fprintf(stderr, "Unable to seek\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nBytes = read(fd, &ehdr, sizeof(ehdr));
|
||||
if (nBytes != sizeof(ehdr))
|
||||
|
@ -308,7 +311,10 @@ static int shdrsLoad(int fd)
|
|||
}
|
||||
|
||||
/* Seek to the start of the table of section headers */
|
||||
lseek(fd, ehdr.e_shoff, SEEK_SET);
|
||||
if (lseek(fd, ehdr.e_shoff, SEEK_SET) == -1) {
|
||||
fprintf(stderr, "Unable to seek\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (ix = 0; ix < ehdr.e_shnum; ix++)
|
||||
{
|
||||
|
@ -429,7 +435,10 @@ static int strTblLoad(int fd, unsigned strTblIx, char **ppStringTable)
|
|||
return -1;
|
||||
}
|
||||
|
||||
lseek(fd, shdr[strTblIx].sh_offset, SEEK_SET);
|
||||
if (lseek(fd, shdr[strTblIx].sh_offset, SEEK_SET) == -1) {
|
||||
fprintf(stderr, "Unable to seek\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nBytes = read(fd, pTable, shdr[strTblIx].sh_size);
|
||||
if (nBytes != shdr[strTblIx].sh_size)
|
||||
|
@ -499,7 +508,10 @@ static void headerAbsoluteSymbolsDump(int fd, FILE *fp, Elf32_Off symTblOffset,
|
|||
/* context the symbol table: pick out absolute syms */
|
||||
|
||||
numSyms = symTblSize / sizeof(Elf32_Sym);
|
||||
lseek(fd, symTblOffset, SEEK_SET);
|
||||
if (lseek(fd, symTblOffset, SEEK_SET) == -1) {
|
||||
fprintf(stderr, "Unable to seek\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (ix = 0; ix < numSyms; ++ix)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue