diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-21 19:08:33 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-06-24 21:12:18 +0300 |
commit | 6888a8ba15f151decee7821a09e34fed2fb63513 (patch) | |
tree | e4e241ce40d20b6afbb3cf443b60b639f465453d /usr/src | |
parent | 9320f4959b6c72e7a6d056623827091cace259ee (diff) | |
download | illumos-gate-6888a8ba15f151decee7821a09e34fed2fb63513.tar.gz |
11107 mcs: NULL pointer errors
Reviewed by: Jason Lippert <jason@glasspelican.ca>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/sgs/mcs/common/file.c | 34 | ||||
-rw-r--r-- | usr/src/cmd/sgs/mcs/common/utils.c | 4 |
2 files changed, 19 insertions, 19 deletions
diff --git a/usr/src/cmd/sgs/mcs/common/file.c b/usr/src/cmd/sgs/mcs/common/file.c index 7fbf0af943..af6d7b8e0a 100644 --- a/usr/src/cmd/sgs/mcs/common/file.c +++ b/usr/src/cmd/sgs/mcs/common/file.c @@ -43,8 +43,8 @@ typedef struct { Seg_Table *b_e_seg_table; section_info_table *sec_table; int64_t *off_table; /* maintains section's offset; set to */ - /* retain old offset, else 0 */ - int64_t *nobits_table; /* maintains NOBITS sections */ + /* retain old offset, else 0 */ + int64_t *nobits_table; /* maintains NOBITS sections */ char *new_sec_string; } file_state_t; @@ -115,7 +115,7 @@ each_file(char *cur_file, Cmd_Info *cmd_info) artmpfile.tmp_name = tempnam(TMPDIR, "mcs2"); if ((fdartmp = open(artmpfile.tmp_name, O_WRONLY | O_APPEND | O_CREAT, - (mode_t)0666)) == NULL) { + (mode_t)0666)) == 0) { error_message(OPEN_TEMP_ERROR, SYSTEM_ERROR, strerror(errno), prog, artmpfile); @@ -313,17 +313,17 @@ static int traverse_file(Elf *elf, GElf_Ehdr * ehdr, char *cur_file, Cmd_Info *cmd_info, file_state_t *state) { - Elf_Scn * scn; - Elf_Scn * temp_scn; - Elf_Data * data; - GElf_Shdr * shdr; - char *temp_name; - section_info_table * sinfo; - GElf_Xword x; - int ret = 0, SYM = 0; /* used by strip command */ - int phnum = ehdr->e_phnum; - unsigned int i, scn_index; - size_t shstrndx, shnum; + Elf_Scn *scn; + Elf_Scn *temp_scn; + Elf_Data *data; + GElf_Shdr *shdr; + char *temp_name; + section_info_table *sinfo; + GElf_Xword x; + int ret = 0, SYM = 0; /* used by strip command */ + int phnum = ehdr->e_phnum; + unsigned int i, scn_index; + size_t shstrndx, shnum; state->Sect_exists = 0; @@ -716,7 +716,7 @@ build_file(Elf *src_elf, GElf_Ehdr *src_ehdr, Cmd_Info *cmd_info, return (FAILURE); } - if (gelf_newehdr(dst_elf, gelf_getclass(src_elf)) == NULL) { + if (gelf_newehdr(dst_elf, gelf_getclass(src_elf)) == 0) { error_message(LIBELF_ERROR, LIBelf_ERROR, elf_errmsg(-1), prog); return (FAILURE); } @@ -743,7 +743,7 @@ build_file(Elf *src_elf, GElf_Ehdr *src_ehdr, Cmd_Info *cmd_info, if (src_ehdr->e_phnum != 0) { (void) elf_flagelf(dst_elf, ELF_C_SET, ELF_F_LAYOUT); - if (gelf_newphdr(dst_elf, src_ehdr->e_phnum) == NULL) { + if (gelf_newphdr(dst_elf, src_ehdr->e_phnum) == 0) { error_message(LIBELF_ERROR, LIBelf_ERROR, elf_errmsg(-1), prog); return (FAILURE); @@ -1041,7 +1041,7 @@ build_file(Elf *src_elf, GElf_Ehdr *src_ehdr, Cmd_Info *cmd_info, dst_shdr.sh_type = SHT_PROGBITS; dst_shdr.sh_flags = 0; dst_shdr.sh_addr = 0; - if (src_ehdr->e_phnum != NULL) + if (src_ehdr->e_phnum != 0) dst_shdr.sh_offset = new_offset; else dst_shdr.sh_offset = 0; diff --git a/usr/src/cmd/sgs/mcs/common/utils.c b/usr/src/cmd/sgs/mcs/common/utils.c index 221fbab834..0016c27b25 100644 --- a/usr/src/cmd/sgs/mcs/common/utils.c +++ b/usr/src/cmd/sgs/mcs/common/utils.c @@ -466,7 +466,7 @@ compress(char *str, size_t *size) mcs_exit(FAILURE); } } - strings[next_str++] = NULL; + strings[next_str++] = '\0'; /* * End get string */ @@ -528,7 +528,7 @@ dohash(char *str) unsigned shift; int t; sum = 1; - for (shift = 0; (t = *str++) != NULL; shift += 7) { + for (shift = 0; (t = *str++) != 0; shift += 7) { sum += (long)t << (shift %= HALFLONG); } sum = low(sum) + high(sum); |