summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-26 18:32:19 +0200
committerToomas Soome <tsoome@me.com>2019-07-30 23:12:43 +0300
commit0afbf5395cf4f4b8d9381a23f852c72b01ec43a4 (patch)
tree752657b7af9c2bcd08133ad2212062fc7ee2b444
parent1580259811fb1670012fc9fad4be9624c2b60dae (diff)
downloadillumos-joyent-0afbf5395cf4f4b8d9381a23f852c72b01ec43a4.tar.gz
11441 th_tools: NULL pointer errors
Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/th_tools/th_define.c46
-rw-r--r--usr/src/cmd/th_tools/th_manage.c6
2 files changed, 21 insertions, 31 deletions
diff --git a/usr/src/cmd/th_tools/th_define.c b/usr/src/cmd/th_tools/th_define.c
index 85650d8436..955dc724fa 100644
--- a/usr/src/cmd/th_tools/th_define.c
+++ b/usr/src/cmd/th_tools/th_define.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/time_impl.h>
#include <sys/wait.h>
#include <stdio.h>
@@ -378,7 +376,7 @@ log_cmp2(const void *p1, const void *p2)
static void
dump_log(uint_t lvl, FILE *fp, struct acc_log_elem *items,
- size_t nitems, uint_t logflags)
+ size_t nitems, uint_t logflags)
{
if (lvl <= dbglvl) {
int i;
@@ -510,8 +508,8 @@ define_one_error(
static void
define_op_err(FILE *fp, int *ecnt, struct bofi_errdef *edp,
- struct acc_log_elem *item, ulong_t nttime, ulong_t interval, char *type,
- int fon, size_t fcnt)
+ struct acc_log_elem *item, ulong_t nttime, ulong_t interval, char *type,
+ int fon, size_t fcnt)
{
coding_t *ct;
char *opname;
@@ -664,13 +662,8 @@ define_op_err(FILE *fp, int *ecnt, struct bofi_errdef *edp,
/* ARGSUSED */
static int
define_nerrs(int fd, FILE *fp, int *ecnt, struct bofi_errdef *edp,
- struct acc_log_elem *items,
- size_t nitems,
- uint_t naccess,
- uint_t minac,
- uint_t maxac,
- ulong_t logtime,
- ulong_t logsize)
+ struct acc_log_elem *items, size_t nitems, uint_t naccess, uint_t minac,
+ uint_t maxac, ulong_t logtime, ulong_t logsize)
{
char *type;
uint_t at;
@@ -878,7 +871,7 @@ define_nerrs(int fd, FILE *fp, int *ecnt, struct bofi_errdef *edp,
static int
reduce_log(uint16_t pol, struct acc_log *log, /* input args */
- struct acc_log_elem **llp, size_t *cntp) /* output args */
+ struct acc_log_elem **llp, size_t *cntp) /* output args */
{
ulong_t logtime;
struct acc_log_elem *items, *item, *elem;
@@ -1050,7 +1043,7 @@ reduce_log(uint16_t pol, struct acc_log *log, /* input args */
static void
log2errdefs(int fd, struct bofi_errdef *edp, struct acc_log *log,
- char *devpath)
+ char *devpath)
{
struct acc_log_elem *items;
size_t nitems;
@@ -1228,7 +1221,8 @@ log2errdefs(int fd, struct bofi_errdef *edp, struct acc_log *log,
#define LLSZMASK (sizeof (longlong_t) -1)
static int
-add_edef(int fd,
+add_edef(
+ int fd,
struct bofi_errdef *errdef, /* returned access criteria */
struct bofi_errstate *errstate,
struct handle_info *hdl, /* handle to match against request */
@@ -1283,10 +1277,8 @@ add_edef(int fd,
}
static void
-collect_state(int fd, int cmd,
- struct bofi_errstate *errstate,
- struct bofi_errdef *errdef,
- char *devpath)
+collect_state(int fd, int cmd, struct bofi_errstate *errstate,
+ struct bofi_errdef *errdef, char *devpath)
{
int rval;
size_t ls = errstate->log.logsize;
@@ -1360,7 +1352,7 @@ collect_state(int fd, int cmd,
static void
print_err_reports(FILE *fp, struct bofi_errstate *esp,
- char *fname, char *cmt, int id)
+ char *fname, char *cmt, int id)
{
if (fname != 0 && *fname != 0)
(void) fprintf(fp, "%sErrdef file %s definition %d:",
@@ -1422,7 +1414,7 @@ thr_collect(void *arg, char *devpath)
*/
static int
match_hinfo(struct handle_info *hp, int instance, uint_t access_type,
- int rnumber, offset_t offset, offset_t len)
+ int rnumber, offset_t offset, offset_t len)
{
msg(9, "matching (%d %d) 0x%x %d offset (%llx, %llx) len (%llx %llx)\n",
@@ -1691,7 +1683,7 @@ walk_callback(di_node_t node, void *arg)
driver_name = di_driver_name(node);
if (driver_name != NULL) {
- if (strcmp(driver_name, warg->name) == NULL &&
+ if (strcmp(driver_name, warg->name) == 0 &&
di_instance(node) == warg->instance) {
path = di_devfs_path(node);
if (path == NULL)
@@ -1746,7 +1738,7 @@ getpath(char *path, int instance, char *name, int pathlen)
*/
static void
test_driver(struct bofi_errdef *edp,
- unsigned long long collecttime)
+ unsigned long long collecttime)
{
pid_t pid;
int statloc;
@@ -2114,13 +2106,13 @@ main(int argc, char *argv[])
if (str != optarg)
errdef.acc_chk = tmpl;
- else if (strcmp(optarg, "PIO") == NULL)
+ else if (strcmp(optarg, "PIO") == 0)
errdef.acc_chk = 1;
- else if (strcmp(optarg, "DMA") == NULL)
+ else if (strcmp(optarg, "DMA") == 0)
errdef.acc_chk = 2;
- else if (strcmp(optarg, "U4FT_ACC_NO_PIO") == NULL)
+ else if (strcmp(optarg, "U4FT_ACC_NO_PIO") == 0)
errdef.acc_chk = 1;
- else if (strcmp(optarg, "U4FT_ACC_NO_DMA") == NULL)
+ else if (strcmp(optarg, "U4FT_ACC_NO_DMA") == 0)
errdef.acc_chk = 2;
else
err = EINVAL;
diff --git a/usr/src/cmd/th_tools/th_manage.c b/usr/src/cmd/th_tools/th_manage.c
index 5b36a01e96..ff28e909c5 100644
--- a/usr/src/cmd/th_tools/th_manage.c
+++ b/usr/src/cmd/th_tools/th_manage.c
@@ -25,8 +25,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -89,7 +87,7 @@ main(int argc, char **argv)
(void) strncpy(path, argv[1], MAXPATHLEN);
for (i = 0; i < CMD_TABLE_SIZE; i++) {
- if (strcmp(argv[2], cmd_table[i].string) == NULL) {
+ if (strcmp(argv[2], cmd_table[i].string) == 0) {
command = cmd_table[i].val;
devctl_command = cmd_table[i].devctl_val;
}
@@ -115,7 +113,7 @@ main(int argc, char **argv)
(void) strncpy(errctl.name, argv[1], MAXNAMELEN);
errctl.instance = atoi(argv[2]);
for (i = 0; i < CMD_TABLE_SIZE; i++) {
- if (strcmp(argv[3], cmd_table[i].string) == NULL) {
+ if (strcmp(argv[3], cmd_table[i].string) == 0) {
command = cmd_table[i].val;
devctl_command = cmd_table[i].devctl_val;
}