mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Many changes to reduce complaints from CppCheck. Several latent bugs fixes, but probably some new typos introduced
This commit is contained in:
@@ -124,12 +124,13 @@ static inline int elf_sectname(FAR struct elf_loadinfo_s *loadinfo,
|
||||
readlen = loadinfo->buflen - bytesread;
|
||||
if (offset + readlen > loadinfo->filelen)
|
||||
{
|
||||
readlen = loadinfo->filelen - offset;
|
||||
if (readlen <= 0)
|
||||
if (loadinfo->filelen <= offset)
|
||||
{
|
||||
bdbg("At end of file\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
readlen = loadinfo->filelen - offset;
|
||||
}
|
||||
|
||||
/* Read that number of bytes into the array */
|
||||
|
||||
@@ -110,12 +110,13 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
|
||||
readlen = loadinfo->buflen - bytesread;
|
||||
if (offset + readlen > loadinfo->filelen)
|
||||
{
|
||||
readlen = loadinfo->filelen - offset;
|
||||
if (readlen <= 0)
|
||||
if (loadinfo->filelen <= offset)
|
||||
{
|
||||
bdbg("At end of file\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
readlen = loadinfo->filelen - offset;
|
||||
}
|
||||
|
||||
/* Read that number of bytes into the array */
|
||||
|
||||
@@ -97,7 +97,6 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
{
|
||||
uint32_t datastart;
|
||||
uint32_t dataend;
|
||||
uint32_t bssstart;
|
||||
uint32_t bssend;
|
||||
int ret;
|
||||
|
||||
@@ -152,7 +151,6 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
datastart = ntohl(loadinfo->header.h_datastart);
|
||||
dataend = ntohl(loadinfo->header.h_dataend);
|
||||
bssstart = dataend;
|
||||
bssend = ntohl(loadinfo->header.h_bssend);
|
||||
|
||||
/* And put this information into the loadinfo structure as well.
|
||||
|
||||
Reference in New Issue
Block a user