summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-21 22:17:10 +0200
committerToomas Soome <tsoome@me.com>2019-07-03 08:46:36 +0300
commitee613b78cf1b6f1080e74ce30191198ffa9bcb11 (patch)
treeb543cf5e979fd5f1a8b3200b00309d5203582513
parent0daffde01c432cf3f4cc2fcc06e4e415e531b5a6 (diff)
downloadillumos-joyent-ee613b78cf1b6f1080e74ce30191198ffa9bcb11.tar.gz
11125 libpicltree: NULL pointer errors
Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/lib/libpicltree/picltree.c22
-rw-r--r--usr/src/lib/libpicltree/ptree_impl.h8
2 files changed, 14 insertions, 16 deletions
diff --git a/usr/src/lib/libpicltree/picltree.c b/usr/src/lib/libpicltree/picltree.c
index ae6cffa645..f62c14e82b 100644
--- a/usr/src/lib/libpicltree/picltree.c
+++ b/usr/src/lib/libpicltree/picltree.c
@@ -591,7 +591,7 @@ picl_hdl_error(picl_hdl_t hdl)
(void) pthread_mutex_lock(&piclhdl_lock);
err = PICL_STALEHANDLE;
if ((pid != picld_pid) || (hash_val >= picl_hdl_hi) ||
- (hash_val == NULL))
+ (hash_val == 0))
err = PICL_INVALIDHANDLE;
(void) pthread_mutex_unlock(&piclhdl_lock);
return (err);
@@ -610,7 +610,7 @@ ptree_hdl_error(picl_hdl_t hdl)
(void) pthread_mutex_lock(&ptreehdl_lock);
err = PICL_STALEHANDLE;
if ((pid != picld_pid) || (hash_val >= ptree_hdl_hi) ||
- (hash_val == NULL))
+ (hash_val == 0))
err = PICL_INVALIDHANDLE;
(void) pthread_mutex_unlock(&ptreehdl_lock);
return (err);
@@ -623,7 +623,7 @@ ptree_hdl_error(picl_hdl_t hdl)
int
cvt_picl2ptree(picl_hdl_t hdl, picl_hdl_t *ptree_hdl)
{
- picl_hdl_t tmph;
+ picl_hdl_t tmph;
int err;
(void) rw_rdlock(&picltbl_rwlock); /* lock picl */
@@ -1430,7 +1430,7 @@ ptree_add_prop(picl_nodehdl_t nodeh, picl_prophdl_t proph)
int err;
picl_obj_t *nodep;
picl_obj_t *propp;
- picl_obj_t *tbl_obj;
+ picl_obj_t *tbl_obj;
picl_obj_t *refobj;
(void) rw_rdlock(&ptree_rwlock); /* RDLock ptree */
@@ -1788,8 +1788,8 @@ ptree_get_next_by_col(picl_prophdl_t proph, picl_prophdl_t *nextcolh)
int
ptree_create_node(const char *name, const char *clname, picl_nodehdl_t *nodeh)
{
- picl_obj_t *pobj;
- ptree_propinfo_t propinfo;
+ picl_obj_t *pobj;
+ ptree_propinfo_t propinfo;
picl_prophdl_t phdl;
picl_prophdl_t cphdl;
int err;
@@ -2097,7 +2097,7 @@ ptree_get_propinfo(picl_prophdl_t proph, ptree_propinfo_t *pinfo)
{
int err;
picl_obj_t *nodep;
- picl_obj_t *propp;
+ picl_obj_t *propp;
(void) rw_rdlock(&ptree_rwlock); /* lock ptree */
nodep = propp = NULL;
@@ -2126,7 +2126,7 @@ xptree_get_propinfo_by_name(picl_nodehdl_t nodeh, const char *pname,
{
int err;
picl_obj_t *nodep;
- picl_obj_t *propp;
+ picl_obj_t *propp;
(void) rw_rdlock(&ptree_rwlock); /* lock ptree */
nodep = propp = NULL;
@@ -2747,7 +2747,7 @@ check_propval(picl_nodehdl_t nodeh, char *pname, char *pval)
{
int err;
picl_prophdl_t proph;
- ptree_propinfo_t pinfo;
+ ptree_propinfo_t pinfo;
void *vbuf;
err = ptree_get_prop_by_name(nodeh, pname, &proph);
@@ -2902,7 +2902,7 @@ ptree_get_node_by_path(const char *piclprl, picl_nodehdl_t *handle)
char *ptr;
char *defprop;
char *tokindex;
- int err;
+ int err;
int len;
int npflg; /* namepath flag */
@@ -3297,7 +3297,7 @@ init_plugin_reg_list(void)
static int
picltree_set_root(picl_nodehdl_t rooth)
{
- picl_obj_t *pobj;
+ picl_obj_t *pobj;
int err;
(void) rw_rdlock(&ptree_rwlock); /* lock ptree */
diff --git a/usr/src/lib/libpicltree/ptree_impl.h b/usr/src/lib/libpicltree/ptree_impl.h
index 034e7b02b8..e1ac516a3e 100644
--- a/usr/src/lib/libpicltree/ptree_impl.h
+++ b/usr/src/lib/libpicltree/ptree_impl.h
@@ -27,8 +27,6 @@
#ifndef _PTREE_IMPL_H
#define _PTREE_IMPL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -52,7 +50,7 @@ typedef uint64_t picl_hdl_t;
/*
* Is the object PICLized?
*/
-#define IS_PICLIZED(x) ((x)->picl_hdl != NULL)
+#define IS_PICLIZED(x) ((x)->picl_hdl != 0)
/*
* A handle is a 64-bit quantity with the daemon's pid value in top 32 bits
@@ -126,7 +124,7 @@ typedef struct picl_prop picl_prop_t;
*/
struct picl_node {
rwlock_t rwlock; /* protects properties */
- picl_obj_t *firstprop;
+ picl_obj_t *firstprop;
char *classname;
picl_obj_t *parent; /* protected by ptree lock */
picl_obj_t *child; /* protected by ptree lock */
@@ -217,7 +215,7 @@ typedef struct picld_plugin_reg_list {
typedef struct picld_plinfo {
char *libname;
char *pathname;
- void *dlh;
+ void *dlh;
struct picld_plinfo *next;
} picld_plugin_desc_t;