diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-21 14:35:43 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-06-24 20:58:47 +0300 |
commit | fb8f92baa78fdf1ddda6f49125fbd59366393ac8 (patch) | |
tree | 8bdeff6d31f2e1fa1c4f6668949f8d7cfc3d035e | |
parent | f2dbfd322ec9cd157a6e2cd8a53569e718a4b0af (diff) | |
download | illumos-joyent-fb8f92baa78fdf1ddda6f49125fbd59366393ac8.tar.gz |
11101 libld: NULL pointer errors
Reviewed by: Jason Lippert <jason@glasspelican.ca>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/cmd/sgs/libld/common/machrel.amd.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/sgs/libld/common/machrel.intel.c | 10 | ||||
-rw-r--r-- | usr/src/cmd/sgs/libld/common/machrel.sparc.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/sgs/libld/common/relocate.c | 28 | ||||
-rw-r--r-- | usr/src/cmd/sgs/libld/common/sections.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/sgs/libld/common/update.c | 6 |
6 files changed, 28 insertions, 28 deletions
diff --git a/usr/src/cmd/sgs/libld/common/machrel.amd.c b/usr/src/cmd/sgs/libld/common/machrel.amd.c index dbdae79bd1..4361980887 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.amd.c +++ b/usr/src/cmd/sgs/libld/common/machrel.amd.c @@ -1322,7 +1322,7 @@ ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl) /* * Perform relocation. */ - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } @@ -1389,7 +1389,7 @@ ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) GOT_REF_TLSLD, ofl, rsp)) == NULL)) { if (ld_assign_got_TLS(local, rsp, ofl, sdp, gnp, GOT_REF_TLSLD, - FLG_REL_MTLS, rtype, R_AMD64_DTPMOD64, NULL) == S_ERROR) + FLG_REL_MTLS, rtype, R_AMD64_DTPMOD64, 0) == S_ERROR) return (S_ERROR); } else if (IS_TLS_GD(rtype) && diff --git a/usr/src/cmd/sgs/libld/common/machrel.intel.c b/usr/src/cmd/sgs/libld/common/machrel.intel.c index d2b72c78a6..65c5908f51 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.intel.c +++ b/usr/src/cmd/sgs/libld/common/machrel.intel.c @@ -1269,7 +1269,7 @@ ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl) Word ortype = rsp->rel_rtype; rsp->rel_rtype = R_386_RELATIVE; - if (ld_add_outrel(NULL, rsp, ofl) == S_ERROR) + if (ld_add_outrel(0, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = ortype; } @@ -1313,7 +1313,7 @@ ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl) /* * Perform relocation. */ - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } static uintptr_t @@ -1343,7 +1343,7 @@ ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if (ld_assign_got_TLS(local, rsp, ofl, sdp, gnp, GOT_REF_TLSIE, FLG_REL_STLS, - rtype, R_386_TLS_TPOFF, NULL) == S_ERROR) + rtype, R_386_TLS_TPOFF, 0) == S_ERROR) return (S_ERROR); } @@ -1362,7 +1362,7 @@ ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if (((flags & FLG_OF_EXEC) == 0) && (rtype == R_386_TLS_IE)) { rsp->rel_rtype = R_386_RELATIVE; - return (ld_add_outrel(NULL, rsp, ofl)); + return (ld_add_outrel(0, rsp, ofl)); } return (1); } @@ -1393,7 +1393,7 @@ ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) GOT_REF_TLSLD, ofl, NULL)) == NULL)) { if (ld_assign_got_TLS(local, rsp, ofl, sdp, gnp, GOT_REF_TLSLD, - FLG_REL_MTLS, rtype, R_386_TLS_DTPMOD32, NULL) == S_ERROR) + FLG_REL_MTLS, rtype, R_386_TLS_DTPMOD32, 0) == S_ERROR) return (S_ERROR); } else if (IS_TLS_GD(rtype) && ((gnp = ld_find_got_ndx(sdp->sd_GOTndxs, diff --git a/usr/src/cmd/sgs/libld/common/machrel.sparc.c b/usr/src/cmd/sgs/libld/common/machrel.sparc.c index 02d180b1c2..93843960e4 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.sparc.c +++ b/usr/src/cmd/sgs/libld/common/machrel.sparc.c @@ -1693,7 +1693,7 @@ ld_reloc_local(Rel_desc *rsp, Ofl_desc *ofl) /* * Perform relocation. */ - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } /* @@ -1777,7 +1777,7 @@ ld_reloc_TLS(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) if (ld_assign_got_TLS(local, rsp, ofl, sdp, gnp, GOT_REF_TLSIE, FLG_REL_STLS, - rtype, M_R_TPOFF, NULL) == S_ERROR) + rtype, M_R_TPOFF, 0) == S_ERROR) return (S_ERROR); } diff --git a/usr/src/cmd/sgs/libld/common/relocate.c b/usr/src/cmd/sgs/libld/common/relocate.c index a1c30c5d56..27c9a5de7f 100644 --- a/usr/src/cmd/sgs/libld/common/relocate.c +++ b/usr/src/cmd/sgs/libld/common/relocate.c @@ -923,7 +923,7 @@ ld_reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) /* * Perform relocation to GOT table entry. */ - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } /* @@ -1002,7 +1002,7 @@ ld_reloc_plt(Rel_desc *rsp, Ofl_desc *ofl) rsp->rel_rtype = ortype; return (1); } else - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } /* @@ -1043,14 +1043,14 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) */ if ((sdp->sd_flags & FLG_SY_SPECSEC) && (sym->st_shndx == SHN_ABS)) { if ((ofl->ofl_flags1 & FLG_OF1_ABSEXEC) == 0) - return ((*ld_targ.t_mr.mr_add_outrel)(NULL, rsp, ofl)); + return ((*ld_targ.t_mr.mr_add_outrel)(0, rsp, ofl)); /* * If -zabsexec is set then promote the ABSOLUTE symbol to * current the current object and perform the relocation now. */ sdp->sd_ref = REF_REL_NEED; - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } /* @@ -1064,9 +1064,9 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) if ((ELF_ST_TYPE(sym->st_info) == STT_OBJECT) && (RELAUX_GET_OSDESC(rsp)->os_shdr->sh_flags & SHF_WRITE)) { if (sdp->sd_flags & FLG_SY_MVTOCOMM) - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); else - return ((*ld_targ.t_mr.mr_add_outrel)(NULL, rsp, ofl)); + return ((*ld_targ.t_mr.mr_add_outrel)(0, rsp, ofl)); } /* @@ -1083,7 +1083,7 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) ELF_ST_TYPE(sym->st_info), 0, &inv_buf), rsp->rel_isdesc->is_file->ifl_name, ld_reloc_sym_name(rsp), sdp->sd_file->ifl_name); - return ((*ld_targ.t_mr.mr_add_outrel)(NULL, rsp, ofl)); + return ((*ld_targ.t_mr.mr_add_outrel)(0, rsp, ofl)); } /* @@ -1279,7 +1279,7 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) DBG_CALL(Dbg_syms_copy_reloc(ofl, _sdp, _sdp->sd_sym->st_value)); } - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } /* @@ -1302,12 +1302,12 @@ reloc_generic(Rel_desc *rsp, Ofl_desc *ofl) * until runtime. */ if (ofl->ofl_flags & FLG_OF_SHAROBJ) - return ((*ld_targ.t_mr.mr_add_outrel)(NULL, rsp, ofl)); + return ((*ld_targ.t_mr.mr_add_outrel)(0, rsp, ofl)); /* * Otherwise process relocation now. */ - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); } /* @@ -1321,7 +1321,7 @@ reloc_relobj(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) Word rtype = rsp->rel_rtype; Sym_desc *sdp = rsp->rel_sym; Is_desc *isp = rsp->rel_isdesc; - Word oflags = NULL; + Word oflags = 0; /* * Determine if we can do any relocations at this point. We can if: @@ -1334,7 +1334,7 @@ reloc_relobj(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) !IS_GOT_BASED(rtype) && !IS_GOT_PC(rtype) && IS_PC_RELATIVE(rtype) && ((sdp->sd_isc) && (sdp->sd_isc->is_osdesc == isp->is_osdesc))) - return (ld_add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(0, rsp, ofl)); /* * If -zredlocsym is in effect, translate all local symbol relocations @@ -1382,7 +1382,7 @@ reloc_relobj(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) */ if ((ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) || (oflags == FLG_REL_SCNNDX)) - if (ld_add_actrel(NULL, rsp, ofl) == S_ERROR) + if (ld_add_actrel(0, rsp, ofl) == S_ERROR) return (S_ERROR); } return ((*ld_targ.t_mr.mr_add_outrel)(oflags, rsp, ofl)); @@ -1673,7 +1673,7 @@ ld_process_sym_reloc(Ofl_desc *ofl, Rel_desc *reld, Rel *reloc, Is_desc *isp, if ((sdp->sd_ref == REF_REL_NEED) || (flags & FLG_OF_BFLAG) || (flags & FLG_OF_SHAROBJ) || (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_NOTYPE)) - return ((*ld_targ.t_mr.mr_add_outrel)(NULL, reld, ofl)); + return ((*ld_targ.t_mr.mr_add_outrel)(0, reld, ofl)); if (sdp->sd_ref == REF_DYN_NEED) return (reloc_exec(reld, ofl)); diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c index 696a18ec40..22b2655105 100644 --- a/usr/src/cmd/sgs/libld/common/sections.c +++ b/usr/src/cmd/sgs/libld/common/sections.c @@ -1695,7 +1695,7 @@ make_cap(Ofl_desc *ofl, Word shtype, const char *shname, int ident) } if (size == 0) - return (NULL); + return (0); if (new_section(ofl, shtype, shname, size, &isec, &shdr, &data) == S_ERROR) @@ -2380,7 +2380,7 @@ make_dynstr(Ofl_desc *ofl) (ELF_ST_BIND(sdp->sd_sym->st_info) != STB_LOCAL)) continue; - if (sdp->sd_sym->st_name == NULL) + if (sdp->sd_sym->st_name == 0) continue; if (st_insert(ofl->ofl_dynstrtab, sdp->sd_name) == -1) diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c index ccd26beb5e..7626520cd7 100644 --- a/usr/src/cmd/sgs/libld/common/update.c +++ b/usr/src/cmd/sgs/libld/common/update.c @@ -207,7 +207,7 @@ update_osym(Ofl_desc *ofl) Word *symshndx = NULL; /* .symtab_shndx table */ Word *dynshndx = NULL; /* .dynsym_shndx table */ Word *ldynshndx = NULL; /* .SUNW_ldynsym_shndx table */ - Word ldynsym_cnt = NULL; /* number of items in */ + Word ldynsym_cnt = 0; /* number of items in */ /* .SUNW_ldynsym */ Str_tbl *shstrtab; Str_tbl *strtab; @@ -307,7 +307,7 @@ update_osym(Ofl_desc *ofl) if (!(flags & FLG_OF_NOVERSEC) && (flags & (FLG_OF_VERNEED | FLG_OF_VERDEF))) { versym = (Versym *)ofl->ofl_osversym->os_outdata->d_buf; - versym[0] = NULL; + versym[0] = 0; } else versym = NULL; @@ -1607,7 +1607,7 @@ update_osym(Ofl_desc *ofl) DBG_CALL(Dbg_syms_old(ofl, sdp)); - spec = NULL; + spec = 0; /* * assign new symbol value. */ |