summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-22 09:10:58 +0200
committerToomas Soome <tsoome@me.com>2019-07-03 23:33:33 +0300
commitc75682cd39b9b3d382ce1b01fef06a84ca7ea0a9 (patch)
tree8393ad19ffa3f09f192d47d0e6a1ae9344649996 /usr/src
parent6e6545bfaed3bab9ce836ee82d1abd8f2edba89a (diff)
downloadillumos-gate-c75682cd39b9b3d382ce1b01fef06a84ca7ea0a9.tar.gz
11133 libproc: NULL pointer errors
Reviewed by: John Levon <john.levon@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libproc/amd64/Pisadep.c4
-rw-r--r--usr/src/lib/libproc/common/Pcore.c4
-rw-r--r--usr/src/lib/libproc/common/Pexecname.c2
-rw-r--r--usr/src/lib/libproc/common/Pstack.c6
-rw-r--r--usr/src/lib/libproc/common/Psymtab.c4
-rw-r--r--usr/src/lib/libproc/common/Psymtab_machelf32.c5
-rw-r--r--usr/src/lib/libproc/i386/Pisadep.c4
7 files changed, 14 insertions, 15 deletions
diff --git a/usr/src/lib/libproc/amd64/Pisadep.c b/usr/src/lib/libproc/amd64/Pisadep.c
index 95064ae33a..360997dab3 100644
--- a/usr/src/lib/libproc/amd64/Pisadep.c
+++ b/usr/src/lib/libproc/amd64/Pisadep.c
@@ -353,9 +353,9 @@ Pstack_iter32(struct ps_prochandle *P, const prgregset_t regs,
if (find_uclink(&ucl, pfp + sizeof (sf_t)))
uc_addr = pfp + sizeof (sf_t);
else
- uc_addr = NULL;
+ uc_addr = (uintptr_t)NULL;
- if (uc_addr != NULL &&
+ if (uc_addr != (uintptr_t)NULL &&
Pread(P, &uc, sizeof (uc), uc_addr) == sizeof (uc)) {
ucontext_32_to_prgregs(&uc, gregs);
fp = gregs[R_FP];
diff --git a/usr/src/lib/libproc/common/Pcore.c b/usr/src/lib/libproc/common/Pcore.c
index 37728190e3..dadda5b2a7 100644
--- a/usr/src/lib/libproc/common/Pcore.c
+++ b/usr/src/lib/libproc/common/Pcore.c
@@ -1934,7 +1934,7 @@ core_find_data(struct ps_prochandle *P, Elf *elf, rd_loadobj_t *rlp)
uint_t i, pagemask;
size_t nphdrs;
- rlp->rl_data_base = NULL;
+ rlp->rl_data_base = (uintptr_t)NULL;
/*
* Find the first loadable, writeable Phdr and compute rl_data_base
@@ -1958,7 +1958,7 @@ core_find_data(struct ps_prochandle *P, Elf *elf, rd_loadobj_t *rlp)
* If we didn't find an appropriate phdr or if the address we
* computed has no mapping, return NULL.
*/
- if (rlp->rl_data_base == NULL ||
+ if (rlp->rl_data_base == (uintptr_t)NULL ||
(mp = Paddr2mptr(P, rlp->rl_data_base)) == NULL)
return (NULL);
diff --git a/usr/src/lib/libproc/common/Pexecname.c b/usr/src/lib/libproc/common/Pexecname.c
index 8af0416e10..cb52191dfe 100644
--- a/usr/src/lib/libproc/common/Pexecname.c
+++ b/usr/src/lib/libproc/common/Pexecname.c
@@ -180,7 +180,7 @@ Pfindexec(struct ps_prochandle *P, const char *aout,
* Fourth try: read the string pointed to by argv[0] out of the
* stack in the process's address space.
*/
- if (P->psinfo.pr_argv != NULL &&
+ if (P->psinfo.pr_argv != (uintptr_t)NULL &&
Pread(P, &addr, sizeof (addr), P->psinfo.pr_argv) != -1 &&
Pread_string(P, path, sizeof (path), (off_t)addr) > 0) {
diff --git a/usr/src/lib/libproc/common/Pstack.c b/usr/src/lib/libproc/common/Pstack.c
index f0f8b5ce8d..fde462c0e2 100644
--- a/usr/src/lib/libproc/common/Pstack.c
+++ b/usr/src/lib/libproc/common/Pstack.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Pstack.c
*
@@ -176,7 +174,7 @@ load_uclist(uclist_t *ucl, const lwpstatus_t *psp)
uint_t new_size, i;
ucontext_t uc;
- if (addr == NULL)
+ if (addr == (uintptr_t)NULL)
return (0);
for (;;) {
@@ -214,7 +212,7 @@ load_uclist(uclist_t *ucl, const lwpstatus_t *psp)
* entry which could indicate a cycle or a very peculiar
* interference pattern between threads.
*/
- if (addr == NULL)
+ if (addr == (uintptr_t)NULL)
break;
for (i = 0; i < ucl->uc_nelems - 1; i++) {
diff --git a/usr/src/lib/libproc/common/Psymtab.c b/usr/src/lib/libproc/common/Psymtab.c
index d5482ae85b..3f1da287e1 100644
--- a/usr/src/lib/libproc/common/Psymtab.c
+++ b/usr/src/lib/libproc/common/Psymtab.c
@@ -624,7 +624,7 @@ Paddr_to_text_map(struct ps_prochandle *P, uintptr_t addr)
* section.
*/
if (fptr != NULL && fptr->file_lo != NULL &&
- (fptr->file_lo->rl_data_base == NULL ||
+ (fptr->file_lo->rl_data_base == (uintptr_t)NULL ||
pmp->pr_vaddr + pmp->pr_size <=
fptr->file_lo->rl_data_base))
return (pmp);
@@ -3128,7 +3128,7 @@ Penv_iter(struct ps_prochandle *P, proc_env_f *func, void *data)
nenv = 0;
}
- if ((envoff = envp[nenv++]) == NULL)
+ if ((envoff = envp[nenv++]) == (uintptr_t)NULL)
break;
/*
diff --git a/usr/src/lib/libproc/common/Psymtab_machelf32.c b/usr/src/lib/libproc/common/Psymtab_machelf32.c
index e2554a0d27..ea972ba1ac 100644
--- a/usr/src/lib/libproc/common/Psymtab_machelf32.c
+++ b/usr/src/lib/libproc/common/Psymtab_machelf32.c
@@ -258,7 +258,7 @@ fake_elf32(struct ps_prochandle *P, file_info_t *fptr, uintptr_t addr,
uint_t i;
Off off;
size_t pltsz = 0, pltentries = 0;
- uintptr_t hptr = NULL;
+ uintptr_t hptr = (uintptr_t)NULL;
Word hnchains = 0, hnbuckets = 0;
if (ehdr->e_type == ET_DYN)
@@ -628,7 +628,8 @@ done_with_plt:
symtabptr = (Sym*)((uintptr_t)symtabptr + addr);
}
- if ((hptr == NULL) || (hnbuckets == 0) || (hnchains == 0)) {
+ if ((hptr == (uintptr_t)NULL) || (hnbuckets == 0) ||
+ (hnchains == 0)) {
dprintf("empty or missing .hash\n");
goto badplt;
}
diff --git a/usr/src/lib/libproc/i386/Pisadep.c b/usr/src/lib/libproc/i386/Pisadep.c
index 855f50a5d4..077ba5ad0d 100644
--- a/usr/src/lib/libproc/i386/Pisadep.c
+++ b/usr/src/lib/libproc/i386/Pisadep.c
@@ -286,9 +286,9 @@ Pstack_iter(struct ps_prochandle *P, const prgregset_t regs,
if (find_uclink(&ucl, pfp + sizeof (sf_t)))
uc_addr = pfp + sizeof (sf_t);
else
- uc_addr = NULL;
+ uc_addr = (uintptr_t)NULL;
- if (uc_addr != NULL &&
+ if (uc_addr != (uintptr_t)NULL &&
Pread(P, &uc, sizeof (uc), uc_addr) == sizeof (uc)) {
ucontext_n_to_prgregs(&uc, gregs);