diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h
index ae93ba38c61891..20449cf8a3d0fd 100644
--- a/include/ibdiag_common.h
+++ b/include/ibdiag_common.h
@@ -139,14 +139,14 @@ extern int ibdiag_process_opts(int argc, char *const argv[], void *context,
 			       const char *usage_args,
 			       const char *usage_examples[]);
 extern void ibdiag_show_usage();
-extern void ibexit(const char *fn, char *msg, ...);
+extern void ibexit(const char *fn, const char *msg, ...);
 
 /* convert counter values to a float with a unit specifier returned (using
  * binary prefix)
  * "data" is a flag indicating this counter is a byte counter multiplied by 4
  * as per PortCounters[Extended]
  */
-extern char *conv_cnt_human_readable(uint64_t val64, float *val, int data);
+const char *conv_cnt_human_readable(uint64_t val64, float *val, int data);
 
 int is_mlnx_ext_port_info_supported(uint32_t vendorid, uint16_t devid);
 
@@ -170,13 +170,13 @@ void dump_portinfo(void *pi, int tabs);
 /**
  * Some common command line parsing
  */
-typedef char *(op_fn_t) (ib_portid_t * dest, char **argv, int argc);
+typedef const char *(op_fn_t)(ib_portid_t *dest, char **argv, int argc);
 
 typedef struct match_rec {
 	const char *name, *alias;
 	op_fn_t *fn;
 	unsigned opt_portnum;
-	char *ops_extra;
+	const char *ops_extra;
 } match_rec_t;
 
 op_fn_t *match_op(const match_rec_t match_tbl[], char *name);
diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index da8263665e33e6..c95f1b10d08610 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -1728,7 +1728,7 @@ extern MAD_EXPORT int ibdebug;
 	exit(-1); \
 } while(0)
 
-MAD_EXPORT void xdump(FILE * file, char *msg, void *p, int size);
+MAD_EXPORT void xdump(FILE * file, const char *msg, void *p, int size);
 
 END_C_DECLS
 #endif				/* _MAD_H_ */
diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c
index d71c5291e94381..d1a69115f06313 100644
--- a/libibmad/src/dump.c
+++ b/libibmad/src/dump.c
@@ -1195,7 +1195,7 @@ void mad_dump_portinfo_ext(char *buf, int bufsz, void *val, int valsz)
 		     IB_PORT_EXT_HDR_FEC_MODE_LAST_F);
 }
 
-void xdump(FILE * file, char *msg, void *p, int size)
+void xdump(FILE * file, const char *msg, void *p, int size)
 {
 #define HEX(x)  ((x) < 10 ? '0' + (x) : 'a' + ((x) -10))
 	uint8_t *cp = p;
diff --git a/libibnetdisc/include/infiniband/ibnetdisc.h b/libibnetdisc/include/infiniband/ibnetdisc.h
index acde1dc20caf4f..8bdc048459c3d2 100644
--- a/libibnetdisc/include/infiniband/ibnetdisc.h
+++ b/libibnetdisc/include/infiniband/ibnetdisc.h
@@ -243,7 +243,7 @@ IBND_EXPORT void ibnd_iter_ports(ibnd_fabric_t * fabric,
  */
 IBND_EXPORT uint64_t ibnd_get_chassis_guid(ibnd_fabric_t * fabric,
 					  unsigned char chassisnum);
-IBND_EXPORT char *ibnd_get_chassis_type(ibnd_node_t * node);
+IBND_EXPORT const char *ibnd_get_chassis_type(ibnd_node_t *node);
 IBND_EXPORT char *ibnd_get_chassis_slot_str(ibnd_node_t * node,
 					   char *str, size_t size);
 
diff --git a/libibnetdisc/src/chassis.c b/libibnetdisc/src/chassis.c
index b0d272de9c5a29..5e0d0550c539fc 100644
--- a/libibnetdisc/src/chassis.c
+++ b/libibnetdisc/src/chassis.c
@@ -50,9 +50,9 @@
 #include "internal.h"
 #include "chassis.h"
 
-static char *ChassisTypeStr[] =
+static const char * const ChassisTypeStr[] =
 { "", "ISR9288", "ISR9096", "ISR2012", "ISR2004", "ISR4700", "ISR4200" };
-static char *ChassisSlotTypeStr[] = { "", "Line", "Spine", "SRBD" };
+static const char * const ChassisSlotTypeStr[] = { "", "Line", "Spine", "SRBD" };
 
 typedef struct chassis_scan {
 	ibnd_chassis_t *first_chassis;
@@ -60,7 +60,7 @@ typedef struct chassis_scan {
 	ibnd_chassis_t *last_chassis;
 } chassis_scan_t;
 
-char *ibnd_get_chassis_type(ibnd_node_t * node)
+const char *ibnd_get_chassis_type(ibnd_node_t * node)
 {
 	int chassis_type;
 
diff --git a/libibnetdisc/src/ibnetdisc.c b/libibnetdisc/src/ibnetdisc.c
index 8455d7f7229743..c89c0d4f10334b 100644
--- a/libibnetdisc/src/ibnetdisc.c
+++ b/libibnetdisc/src/ibnetdisc.c
@@ -515,8 +515,8 @@ static void link_ports(ibnd_node_t * node, ibnd_port_t * port,
 	remoteport->remoteport = port;
 }
 
-static void dump_endnode(ib_portid_t * path, char *prompt,
-			 ibnd_node_t * node, ibnd_port_t * port)
+static void dump_endnode(ib_portid_t *path, const char *prompt,
+			 ibnd_node_t *node, ibnd_port_t *port)
 {
 	char type[64];
 	mad_dump_node_type(type, sizeof(type), &node->type, sizeof(int));
diff --git a/libibnetdisc/test/testleaks.c b/libibnetdisc/test/testleaks.c
index dc920c71fa6515..dd216b134d6f41 100644
--- a/libibnetdisc/test/testleaks.c
+++ b/libibnetdisc/test/testleaks.c
@@ -51,7 +51,7 @@
 #include <infiniband/complib/cl_nodenamemap.h>
 #include <infiniband/ibnetdisc.h>
 
-char *argv0 = "iblinkinfotest";
+const char *argv0 = "iblinkinfotest";
 static FILE *f;
 
 void usage(void)
diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c
index b5208390b5ae90..904089b3b2e8e8 100644
--- a/src/ibcacheedit.c
+++ b/src/ibcacheedit.c
@@ -267,7 +267,7 @@ int main(int argc, char **argv)
 		 "Specify before and after port guid to edit"},
 		{0}
 	};
-	char *usage_args = "<orig.cache> <new.cache>";
+	const char *usage_args = "<orig.cache> <new.cache>";
 
 	ibdiag_process_opts(argc, argv, NULL, "CDdeGKLPstvy",
 			    opts, process_opt, usage_args,
diff --git a/src/ibccconfig.c b/src/ibccconfig.c
index 64aa804c198182..19a075aa9dd435 100644
--- a/src/ibccconfig.c
+++ b/src/ibccconfig.c
@@ -81,7 +81,7 @@ static const match_rec_t match_tbl[] = {
 uint64_t cckey = 0;
 
 /*******************************************/
-static char *parselonglongint(char *arg, uint64_t *val)
+static const char *parselonglongint(char *arg, uint64_t *val)
 {
 	char *endptr = NULL;
 
@@ -97,7 +97,7 @@ static char *parselonglongint(char *arg, uint64_t *val)
 	return NULL;
 }
 
-static char *parseint(char *arg, uint32_t *val, int hexonly)
+static const char *parseint(char *arg, uint32_t *val, int hexonly)
 {
 	char *endptr = NULL;
 
@@ -113,7 +113,7 @@ static char *parseint(char *arg, uint32_t *val, int hexonly)
 	return NULL;
 }
 
-static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc)
+static const char *congestion_key_info(ib_portid_t *dest, char **argv, int argc)
 {
 	uint8_t rcv[IB_CC_DATA_SZ] = { 0 };
 	uint8_t payload[IB_CC_DATA_SZ] = { 0 };
@@ -121,7 +121,7 @@ static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc)
 	uint32_t cc_keyprotectbit;
 	uint32_t cc_keyleaseperiod;
 	uint32_t cc_keyviolations;
-	char *errstr;
+	const char *errstr;
 
 	if (argc != 4)
 		return "invalid number of parameters for CongestionKeyInfo";
@@ -174,7 +174,7 @@ static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc)
 
 
 /* parse like it's a hypothetical 256 bit hex code */
-static char *parse256(char *arg, uint8_t *buf)
+static const char *parse256(char *arg, uint8_t *buf)
 {
 	int numdigits = 0;
 	int startindex;
@@ -202,7 +202,7 @@ static char *parse256(char *arg, uint8_t *buf)
 	for (i = startindex; i <= 31; i++) {
 		char tmp[3] = { 0 };
 		uint32_t tmpint;
-		char *errstr;
+		const char *errstr;
 
 		/* I can't help but think there is a strtoX that
 		 * will do this for me, but I can't find it.
@@ -224,10 +224,10 @@ static char *parse256(char *arg, uint8_t *buf)
 	return NULL;
 }
 
-static char *parsecct(char *arg, uint32_t *shift, uint32_t *multiplier)
+static const char *parsecct(char *arg, uint32_t *shift, uint32_t *multiplier)
 {
 	char buf[1024] = { 0 };
-	char *errstr;
+	const char *errstr;
 	char *ptr;
 
 	strcpy(buf, arg);
@@ -247,7 +247,8 @@ static char *parsecct(char *arg, uint32_t *shift, uint32_t *multiplier)
 	return NULL;	
 }
 
-static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc)
+static const char *switch_congestion_setting(ib_portid_t *dest, char **argv,
+					     int argc)
 {
 	uint8_t rcv[IB_CC_DATA_SZ] = { 0 };
 	uint8_t payload[IB_CC_DATA_SZ] = { 0 };
@@ -261,7 +262,7 @@ static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc
 	uint32_t cs_returndelay_m;
 	uint32_t cs_returndelay;
 	uint32_t marking_rate;
-	char *errstr;
+	const char *errstr;
 
 	if (argc != 8)
 		return "invalid number of parameters for SwitchCongestionSetting";
@@ -334,7 +335,8 @@ static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc
 	return NULL;
 }
 
-static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int argc)
+static const char *switch_port_congestion_setting(ib_portid_t *dest,
+						  char **argv, int argc)
 {
 	uint8_t rcv[IB_CC_DATA_SZ] = { 0 };
 	uint8_t payload[IB_CC_DATA_SZ] = { 0 };
@@ -348,7 +350,7 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 	uint32_t type;
 	uint32_t numports;
 	uint8_t *ptr;
-	char *errstr;
+	const char *errstr;
 
 	if (argc != 6)
 		return "invalid number of parameters for SwitchPortCongestion";
@@ -418,7 +420,8 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 	return NULL;
 }
 
-static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc)
+static const char *ca_congestion_setting(ib_portid_t *dest, char **argv,
+					 int argc)
 {
 	uint8_t rcv[IB_CC_DATA_SZ] = { 0 };
 	uint8_t payload[IB_CC_DATA_SZ] = { 0 };
@@ -428,7 +431,7 @@ static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc)
 	uint32_t ccti_increase;
 	uint32_t trigger_threshold;
 	uint32_t ccti_min;
-	char *errstr;
+	const char *errstr;
 	int i;
 
 	if (argc != 6)
@@ -492,7 +495,8 @@ static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc)
+static const char *congestion_control_table(ib_portid_t *dest, char **argv,
+					    int argc)
 {
 	uint8_t rcv[IB_CC_DATA_SZ] = { 0 };
 	uint8_t payload[IB_CC_DATA_SZ] = { 0 };
@@ -500,7 +504,7 @@ static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc)
 	uint32_t index;
 	uint32_t cctshifts[64];
 	uint32_t cctmults[64];
-	char *errstr;
+	const char *errstr;
 	int i;
 
 	if (argc < 2 || argc > 66)
@@ -558,7 +562,7 @@ int main(int argc, char **argv)
 	char usage_args[1024];
 	int mgmt_classes[3] = { IB_SMI_CLASS, IB_SA_CLASS, IB_CC_CLASS };
 	ib_portid_t portid = { 0 };
-	char *err;
+	const char *err;
 	op_fn_t *fn;
 	const match_rec_t *r;
 	int n;
diff --git a/src/ibccquery.c b/src/ibccquery.c
index 95e553d2dce426..9bcbf8645b7bd6 100644
--- a/src/ibccquery.c
+++ b/src/ibccquery.c
@@ -79,7 +79,7 @@ static const match_rec_t match_tbl[] = {
 uint64_t cckey = 0;
 
 /*******************************************/
-static char *class_port_info(ib_portid_t * dest, char **argv, int argc)
+static const char *class_port_info(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -94,7 +94,7 @@ static char *class_port_info(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *congestion_info(ib_portid_t * dest, char **argv, int argc)
+static const char *congestion_info(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -109,7 +109,7 @@ static char *congestion_info(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc)
+static const char *congestion_key_info(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -124,7 +124,7 @@ static char *congestion_key_info(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *congestion_log(ib_portid_t * dest, char **argv, int argc)
+static const char *congestion_log(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_CC_LOG_DATA_SZ] = { 0 };
@@ -180,7 +180,8 @@ static char *congestion_log(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc)
+static const char *switch_congestion_setting(ib_portid_t *dest, char **argv,
+					     int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -195,7 +196,8 @@ static char *switch_congestion_setting(ib_portid_t * dest, char **argv, int argc
 	return NULL;
 }
 
-static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int argc)
+static const char *switch_port_congestion_setting(ib_portid_t *dest,
+						  char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -257,7 +259,8 @@ static char *switch_port_congestion_setting(ib_portid_t * dest, char **argv, int
 	return NULL;
 }
 
-static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc)
+static const char *ca_congestion_setting(ib_portid_t *dest, char **argv,
+					 int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -281,7 +284,8 @@ static char *ca_congestion_setting(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc)
+static const char *congestion_control_table(ib_portid_t *dest, char **argv,
+					    int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -321,7 +325,7 @@ static char *congestion_control_table(ib_portid_t * dest, char **argv, int argc)
 	return NULL;
 }
 
-static char *timestamp_dump(ib_portid_t * dest, char **argv, int argc)
+static const char *timestamp_dump(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_CC_DATA_SZ] = { 0 };
@@ -353,7 +357,7 @@ int main(int argc, char **argv)
 	char usage_args[1024];
 	int mgmt_classes[3] = { IB_SMI_CLASS, IB_SA_CLASS, IB_CC_CLASS };
 	ib_portid_t portid = { 0 };
-	char *err;
+	const char *err;
 	op_fn_t *fn;
 	const match_rec_t *r;
 	int n;
diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c
index bc1d897c422bbb..cfc7b926b61d94 100644
--- a/src/ibdiag_common.c
+++ b/src/ibdiag_common.c
@@ -413,7 +413,7 @@ int ibdiag_process_opts(int argc, char *const argv[], void *cxt,
 	return 0;
 }
 
-void ibexit(const char *fn, char *msg, ...)
+void ibexit(const char *fn, const char *msg, ...)
 {
 	char buf[512];
 	va_list va;
@@ -434,8 +434,7 @@ void ibexit(const char *fn, char *msg, ...)
 	exit(-1);
 }
 
-char *
-conv_cnt_human_readable(uint64_t val64, float *val, int data)
+const char *conv_cnt_human_readable(uint64_t val64, float *val, int data)
 {
 	uint64_t tmp = val64;
 	int ui = 0;
diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c
index deccb090c8e31f..0252d5bbd0d9e9 100644
--- a/src/iblinkinfo.c
+++ b/src/iblinkinfo.c
@@ -104,7 +104,7 @@ int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port)
 	return (fistate == IB_LINK_DOWN) ? 1 : 0;
 }
 
-void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix)
+void print_port(ibnd_node_t *node, ibnd_port_t *port, const char *out_prefix)
 {
 	char width[64], speed[64], state[64], physstate[64];
 	char remote_guid_str[256];
@@ -272,7 +272,7 @@ static inline const char *nodetype_str(ibnd_node_t * node)
 }
 
 void print_node_header(ibnd_node_t *node, int *out_header_flag,
-			char *out_prefix)
+		       const char *out_prefix)
 {
 	uint64_t guid = 0;
 	if ((!out_header_flag || !(*out_header_flag)) && !line_mode) {
@@ -321,8 +321,8 @@ struct iter_diff_data {
         uint32_t diff_flags;
         ibnd_fabric_t *fabric1;
         ibnd_fabric_t *fabric2;
-        char *fabric1_prefix;
-        char *fabric2_prefix;
+        const char *fabric1_prefix;
+        const char *fabric2_prefix;
 };
 
 void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node,
@@ -417,7 +417,7 @@ void diff_node_iter(ibnd_node_t * fabric1_node, void *iter_user_data)
 
 	fabric2_node = ibnd_find_node_guid(data->fabric2, fabric1_node->guid);
 	if (!fabric2_node)
-		print_node(fabric1_node, data->fabric1_prefix);
+		print_node(fabric1_node, (void *)data->fabric1_prefix);
 	else if (data->diff_flags &
 		 (DIFF_FLAG_PORT_CONNECTION | DIFF_FLAG_PORT_STATE
 		  | DIFF_FLAG_LID | DIFF_FLAG_NODE_DESCRIPTION)) {
diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c
index 0eef703b5e5f6d..f3bfa5d353858c 100644
--- a/src/ibnetdiscover.c
+++ b/src/ibnetdiscover.c
@@ -84,7 +84,7 @@ static int full_info;
  * Define our own conversion functions to maintain compatibility with the old
  * ibnetdiscover which did not use the ibmad conversion functions.
  */
-char *dump_linkspeed_compat(uint32_t speed)
+const char *dump_linkspeed_compat(uint32_t speed)
 {
 	switch (speed) {
 	case 1:
@@ -100,7 +100,8 @@ char *dump_linkspeed_compat(uint32_t speed)
 	return ("???");
 }
 
-char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, uint32_t fdr10)
+const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed,
+				     uint32_t fdr10)
 {
 	switch (espeed) {
 	case 0:
@@ -122,7 +123,7 @@ char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, uint32_t fdr10)
 	return ("???");
 }
 
-char *dump_linkwidth_compat(uint32_t width)
+const char *dump_linkwidth_compat(uint32_t width)
 {
 	switch (width) {
 	case 1:
@@ -220,7 +221,7 @@ void list_nodes(ibnd_fabric_t * fabric, int list)
 		ibnd_iter_nodes_type(fabric, list_node, IB_NODE_ROUTER, NULL);
 }
 
-void out_ids(ibnd_node_t * node, int group, char *chname, char *out_prefix)
+void out_ids(ibnd_node_t *node, int group, char *chname, const char *out_prefix)
 {
 	uint64_t sysimgguid =
 	    mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F);
@@ -258,7 +259,7 @@ uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum)
 	return guid;
 }
 
-void out_switch_detail(ibnd_node_t * node, char *sw_prefix)
+void out_switch_detail(ibnd_node_t * node, const char *sw_prefix)
 {
 	char *nodename = NULL;
 
@@ -272,10 +273,10 @@ void out_switch_detail(ibnd_node_t * node, char *sw_prefix)
 	free(nodename);
 }
 
-void out_switch(ibnd_node_t * node, int group, char *chname, char *id_prefix,
-		char *sw_prefix)
+void out_switch(ibnd_node_t *node, int group, char *chname,
+		const char *id_prefix, const char *sw_prefix)
 {
-	char *str;
+	const char *str;
 	char str2[256];
 
 	out_ids(node, group, chname, id_prefix);
@@ -298,9 +299,9 @@ void out_switch(ibnd_node_t * node, int group, char *chname, char *id_prefix,
 	fprintf(f, "\n");
 }
 
-void out_ca_detail(ibnd_node_t * node, char *ca_prefix)
+void out_ca_detail(ibnd_node_t *node, const char *ca_prefix)
 {
-	char *node_type;
+	const char *node_type;
 
 	switch (node->type) {
 	case IB_NODE_CA:
@@ -319,10 +320,10 @@ void out_ca_detail(ibnd_node_t * node, char *ca_prefix)
 		clean_nodedesc(node->nodedesc));
 }
 
-void out_ca(ibnd_node_t * node, int group, char *chname, char *id_prefix,
-	    char *ca_prefix)
+void out_ca(ibnd_node_t *node, int group, char *chname, const char *id_prefix,
+	    const char *ca_prefix)
 {
-	char *node_type;
+	const char *node_type;
 
 	out_ids(node, group, chname, id_prefix);
 	switch (node->type) {
@@ -359,7 +360,8 @@ static char *out_ext_port(ibnd_port_t * port, int group)
 	return (NULL);
 }
 
-void out_switch_port(ibnd_port_t * port, int group, char *out_prefix)
+static void out_switch_port(ibnd_port_t *port, int group,
+			    const char *out_prefix)
 {
 	char *ext_port_str = NULL;
 	char *rem_nodename = NULL;
@@ -427,7 +429,7 @@ void out_switch_port(ibnd_port_t * port, int group, char *out_prefix)
 	free(rem_nodename);
 }
 
-void out_ca_port(ibnd_port_t * port, int group, char *out_prefix)
+void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix)
 {
 	char *str = NULL;
 	char *rem_nodename = NULL;
@@ -760,11 +762,12 @@ struct iter_diff_data {
 	uint32_t diff_flags;
 	ibnd_fabric_t *fabric1;
 	ibnd_fabric_t *fabric2;
-	char *fabric1_prefix;
-	char *fabric2_prefix;
-	void (*out_header) (ibnd_node_t *, int, char *, char *, char *);
-	void (*out_header_detail) (ibnd_node_t *, char *);
-	void (*out_port) (ibnd_port_t *, int, char *);
+	const char *fabric1_prefix;
+	const char *fabric2_prefix;
+	void (*out_header)(ibnd_node_t *, int, char *, const char *,
+			   const char *);
+	void (*out_header_detail)(ibnd_node_t *, const char *);
+	void (*out_port)(ibnd_port_t *, int, const char *);
 };
 
 static void diff_iter_out_header(ibnd_node_t * node,
@@ -921,12 +924,12 @@ static void diff_iter_func(ibnd_node_t * fabric1_node, void *iter_user_data)
 	}
 }
 
-static int diff_common(ibnd_fabric_t * orig_fabric, ibnd_fabric_t * new_fabric,
+static int diff_common(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric,
 		       int node_type, uint32_t diff_flags,
-		       void (*out_header) (ibnd_node_t *, int, char *, char *,
-					   char *),
-		       void (*out_header_detail) (ibnd_node_t *, char *),
-		       void (*out_port) (ibnd_port_t *, int, char *))
+		       void (*out_header)(ibnd_node_t *, int, char *,
+					  const char *, const char *),
+		       void (*out_header_detail)(ibnd_node_t *, const char *),
+		       void (*out_port)(ibnd_port_t *, int, const char *))
 {
 	struct iter_diff_data iter_diff_data;
 
diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c
index 43b062a14ed797..4d5bc7c21b7498 100644
--- a/src/ibqueryerrors.c
+++ b/src/ibqueryerrors.c
@@ -92,11 +92,11 @@ struct {
 } summary = { 0 };
 
 #define DEF_THRES_FILE IBDIAG_CONFIG_PATH"/error_thresholds"
-static char *threshold_file = DEF_THRES_FILE;
+static const char *threshold_file = DEF_THRES_FILE;
 
 /* define a "packet" with threshold values in it */
 uint8_t thresholds[1204] = { 0 };
-char * threshold_str = "";
+char *threshold_str = NULL;
 
 static unsigned valid_gid(ib_gid_t * gid)
 {
@@ -127,7 +127,7 @@ static void set_thres(char *name, uint64_t val)
 	}
 }
 
-static void set_thresholds(char *threshold_file)
+static void set_thresholds(const char *threshold_file)
 {
 	char buf[1024];
 	uint64_t val = 0;
@@ -399,7 +399,7 @@ static int check_threshold(uint8_t *pc, uint8_t *pce, uint32_t cap_mask2,
 	uint64_t val64 = 0;
 	int is_exceeds = 0;
 	float val = 0;
-	char *unit = "";
+	const char *unit = "";
 
 	if (htonl(cap_mask2) & IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP) {
 		mad_decode_field(pce, ext_i, (void *)&val64);
@@ -488,7 +488,7 @@ static int print_results(ib_portid_t * portid, char *node_name,
 			for (i = start_field; i <= end_field; i++) {
 				uint64_t val64 = 0;
 				float val = 0;
-				char *unit = "";
+				const char *unit = "";
 				mad_decode_field(pkt, i, (void *)&val64);
 				if (val64) {
 					int data = 0;
@@ -614,7 +614,7 @@ static int print_data_cnts(ib_portid_t * portid, uint16_t cap_mask,
 	for (i = start_field; i <= end_field; i++) {
 		uint64_t val64 = 0;
 		float val = 0;
-		char *unit = "";
+		const char *unit = "";
 		int data = 0;
 		mad_decode_field(pc, i, (void *)&val64);
 		if (i == IB_PC_EXT_XMT_BYTES_F || i == IB_PC_EXT_RCV_BYTES_F ||
diff --git a/src/ibroute.c b/src/ibroute.c
index 2514073970b481..111524ae97299d 100644
--- a/src/ibroute.c
+++ b/src/ibroute.c
@@ -59,8 +59,8 @@ static nn_map_t *node_name_map = NULL;
 
 /*******************************************/
 
-char *check_switch(ib_portid_t * portid, unsigned int *nports, uint64_t * guid,
-		   uint8_t * sw, char *nd)
+const char *check_switch(ib_portid_t *portid, unsigned int *nports,
+			 uint64_t *guid, uint8_t *sw, char *nd)
 {
 	uint8_t ni[IB_SMP_DATA_SIZE] = { 0 };
 	int type;
@@ -135,13 +135,13 @@ int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports,
 
 uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } };
 
-char *dump_multicast_tables(ib_portid_t * portid, unsigned startlid,
-			    unsigned endlid)
+const char *dump_multicast_tables(ib_portid_t *portid, unsigned startlid,
+				  unsigned endlid)
 {
 	char nd[IB_SMP_DATA_SIZE] = { 0 };
 	uint8_t sw[IB_SMP_DATA_SIZE] = { 0 };
-	char str[512];
-	char *s;
+	char str[512], *s;
+	const char *err;
 	uint64_t nodeguid;
 	uint32_t mod;
 	unsigned block, i, j, e, nports, cap, chunks, startblock, lastblock,
@@ -149,8 +149,8 @@ char *dump_multicast_tables(ib_portid_t * portid, unsigned startlid,
 	char *mapnd = NULL;
 	int n = 0;
 
-	if ((s = check_switch(portid, &nports, &nodeguid, sw, nd)))
-		return s;
+	if ((err = check_switch(portid, &nports, &nodeguid, sw, nd)))
+		return err;
 
 	mad_decode_field(sw, IB_SW_MCAST_FDB_CAP_F, &cap);
 	mad_decode_field(sw, IB_SW_MCAST_FDB_TOP_F, &top);
@@ -322,12 +322,13 @@ int dump_lid(char *str, int strlen, int lid, int valid)
 	return rc;
 }
 
-char *dump_unicast_tables(ib_portid_t * portid, int startlid, int endlid)
+const char *dump_unicast_tables(ib_portid_t *portid, int startlid, int endlid)
 {
 	char lft[IB_SMP_DATA_SIZE] = { 0 };
 	char nd[IB_SMP_DATA_SIZE] = { 0 };
 	uint8_t sw[IB_SMP_DATA_SIZE] = { 0 };
-	char str[200], *s;
+	char str[200];
+	const char *s;
 	uint64_t nodeguid;
 	int block, i, e, top;
 	unsigned nports;
@@ -423,7 +424,7 @@ int main(int argc, char **argv)
 	    { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS };
 	ib_portid_t portid = { 0 };
 	unsigned startlid = 0, endlid = 0;
-	char *err;
+	const char *err;
 
 	const struct ibdiag_opt opts[] = {
 		{"all", 'a', 0, NULL, "show all lids, even invalid entries"},
diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c
index 7044deb783d8c3..d892c97fc4fc40 100644
--- a/src/ibsendtrap.c
+++ b/src/ibsendtrap.c
@@ -208,7 +208,7 @@ static int send_trap(void (*build) (ib_mad_notice_attr_t *, ib_portid_t *))
 }
 
 typedef struct _trap_def {
-	char *trap_name;
+	const char *trap_name;
 	void (*build_func) (ib_mad_notice_attr_t *, ib_portid_t *);
 } trap_def_t;
 
@@ -224,7 +224,7 @@ static const trap_def_t traps[] = {
 	{NULL, NULL}
 };
 
-int process_send_trap(char *trap_name)
+int process_send_trap(const char *trap_name)
 {
 	int i;
 
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
 {
 	char usage_args[1024];
 	int mgmt_classes[2] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS };
-	char *trap_name = NULL;
+	const char *trap_name = NULL;
 	int i, n, rc;
 
 	n = sprintf(usage_args, "[<trap_name>] [<error_port>]\n"
diff --git a/src/ibstat.c b/src/ibstat.c
index bad4c99800e721..1e62a06735453d 100644
--- a/src/ibstat.c
+++ b/src/ibstat.c
@@ -54,7 +54,7 @@
 
 #include <ibdiag_common.h>
 
-static char *node_type_str[] = {
+static const char * const node_type_str[] = {
 	"???",
 	"CA",
 	"Switch",
@@ -82,7 +82,7 @@ static void ca_dump(umad_ca_t * ca)
 	       be64toh(ca->system_guid));
 }
 
-static char *port_state_str[] = {
+static const char * const port_state_str[] = {
 	"???",
 	"Down",
 	"Initializing",
@@ -90,7 +90,7 @@ static char *port_state_str[] = {
 	"Active"
 };
 
-static char *port_phy_state_str[] = {
+static const char * const port_phy_state_str[] = {
 	"No state change",
 	"Sleep",
 	"Polling",
@@ -110,8 +110,8 @@ static int ret_code(void)
 	return e;
 }
 
-static int sys_read_string(char *dir_name, char *file_name, char *str,
-			   int max_len)
+static int sys_read_string(const char *dir_name, const char *file_name,
+			   char *str, int max_len)
 {
 	char path[256], *s;
 	int fd, r;
@@ -163,8 +163,8 @@ done:
 
 static int port_dump(umad_port_t * port, int alone)
 {
-	char *pre = "";
-	char *hdrpre = "";
+	const char *pre = "";
+	const char *hdrpre = "";
 
 	if (!port)
 		return -1;
diff --git a/src/ibtracert.c b/src/ibtracert.c
index 92c7f061fa155e..2fc8b9879225a8 100644
--- a/src/ibtracert.c
+++ b/src/ibtracert.c
@@ -56,7 +56,7 @@ struct ibmad_port *srcport;
 
 #define MAXHOPS	63
 
-static char *node_type_str[] = {
+static const char * const node_type_str[] = {
 	"???",
 	"ca",
 	"switch",
@@ -214,7 +214,7 @@ static int extend_dpath(ib_dr_path_t * path, int nextport)
 	return path->cnt;
 }
 
-static void dump_endnode(int dump, char *prompt, Node * node, Port * port)
+static void dump_endnode(int dump, const char *prompt, Node *node, Port *port)
 {
 	char *nodename = NULL;
 
diff --git a/src/mcm_rereg_test.c b/src/mcm_rereg_test.c
index 182749e7a16e0d..197a7877d2956a 100644
--- a/src/mcm_rereg_test.c
+++ b/src/mcm_rereg_test.c
@@ -309,8 +309,8 @@ static int rereg_query_all(int port, int agent, ib_portid_t * dport,
 
 #define MAX_CLIENTS 50
 
-static int rereg_and_test_port(char *guid_file, int port, int agent,
-			       ib_portid_t * dport, int timeout)
+static int rereg_and_test_port(const char *guid_file, int port, int agent,
+			       ib_portid_t *dport, int timeout)
 {
 	char line[256];
 	FILE *f;
@@ -356,9 +356,9 @@ static int rereg_and_test_port(char *guid_file, int port, int agent,
 	return 0;
 }
 
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
 {
-	char *guid_file = "port_guids.list";
+	const char *guid_file = "port_guids.list";
 	int mgmt_classes[2] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS };
 	ib_portid_t dport_id;
 	int port, agent;
diff --git a/src/sminfo.c b/src/sminfo.c
index 894d9fc38262c1..caec7cf00d5f3d 100644
--- a/src/sminfo.c
+++ b/src/sminfo.c
@@ -62,7 +62,7 @@ enum {
 	SMINFO_STATE_LAST,
 };
 
-char *statestr[] = {
+const char *const statestr[] = {
 	"SMINFO_NOTACT",
 	"SMINFO_DISCOVER",
 	"SMINFO_STANDBY",
diff --git a/src/smpquery.c b/src/smpquery.c
index 37461b8b2e76e3..4a104174fdcb34 100644
--- a/src/smpquery.c
+++ b/src/smpquery.c
@@ -76,7 +76,7 @@ static nn_map_t *node_name_map = NULL;
 static int extended_speeds = 0;
 
 /*******************************************/
-static char *node_desc(ib_portid_t * dest, char **argv, int argc)
+static const char *node_desc(ib_portid_t *dest, char **argv, int argc)
 {
 	int node_type, l;
 	uint64_t node_guid;
@@ -110,7 +110,7 @@ static char *node_desc(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *node_info(ib_portid_t * dest, char **argv, int argc)
+static const char *node_info(ib_portid_t * dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_SMP_DATA_SIZE] = { 0 };
@@ -124,7 +124,7 @@ static char *node_info(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *port_info_extended(ib_portid_t * dest, char **argv, int argc)
+static const char *port_info_extended(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
@@ -146,7 +146,7 @@ static char *port_info_extended(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *port_info(ib_portid_t * dest, char **argv, int argc)
+static const char *port_info(ib_portid_t *dest, char **argv, int argc)
 {
 	char data[IB_SMP_DATA_SIZE] = { 0 };
 	int portnum = 0, orig_portnum;
@@ -165,7 +165,7 @@ static char *port_info(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *mlnx_ext_port_info(ib_portid_t * dest, char **argv, int argc)
+static const char *mlnx_ext_port_info(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2300];
 	char data[IB_SMP_DATA_SIZE];
@@ -183,7 +183,7 @@ static char *mlnx_ext_port_info(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *switch_info(ib_portid_t * dest, char **argv, int argc)
+static const char *switch_info(ib_portid_t *dest, char **argv, int argc)
 {
 	char buf[2048];
 	char data[IB_SMP_DATA_SIZE] = { 0 };
@@ -197,7 +197,7 @@ static char *switch_info(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *pkey_table(ib_portid_t * dest, char **argv, int argc)
+static const char *pkey_table(ib_portid_t *dest, char **argv, int argc)
 {
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
 	int i, j, k;
@@ -249,7 +249,7 @@ static char *pkey_table(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *sl2vl_dump_table_entry(ib_portid_t * dest, int in, int out)
+static const char *sl2vl_dump_table_entry(ib_portid_t *dest, int in, int out)
 {
 	char buf[2048];
 	char data[IB_SMP_DATA_SIZE] = { 0 };
@@ -264,12 +264,12 @@ static char *sl2vl_dump_table_entry(ib_portid_t * dest, int in, int out)
 	return 0;
 }
 
-static char *sl2vl_table(ib_portid_t * dest, char **argv, int argc)
+static const char *sl2vl_table(ib_portid_t *dest, char **argv, int argc)
 {
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
 	int type, num_ports, portnum = 0;
 	int i;
-	char *ret;
+	const char *ret;
 
 	if (argc > 0)
 		portnum = strtol(argv[0], 0, 0);
@@ -299,8 +299,8 @@ static char *sl2vl_table(ib_portid_t * dest, char **argv, int argc)
 	return 0;
 }
 
-static char *vlarb_dump_table_entry(ib_portid_t * dest, int portnum, int offset,
-				    unsigned cap)
+static const char *vlarb_dump_table_entry(ib_portid_t *dest, int portnum,
+					  int offset, unsigned cap)
 {
 	char buf[2048];
 	char data[IB_SMP_DATA_SIZE] = { 0 };
@@ -313,10 +313,10 @@ static char *vlarb_dump_table_entry(ib_portid_t * dest, int portnum, int offset,
 	return 0;
 }
 
-static char *vlarb_dump_table(ib_portid_t * dest, int portnum,
-			      char *name, int offset, int cap)
+static const char *vlarb_dump_table(ib_portid_t *dest, int portnum,
+				    const char *name, int offset, int cap)
 {
-	char *ret;
+	const char *ret;
 
 	printf("# %s priority VL Arbitration Table:", name);
 	ret = vlarb_dump_table_entry(dest, portnum, offset,
@@ -327,12 +327,12 @@ static char *vlarb_dump_table(ib_portid_t * dest, int portnum,
 	return ret;
 }
 
-static char *vlarb_table(ib_portid_t * dest, char **argv, int argc)
+static const char *vlarb_table(ib_portid_t *dest, char **argv, int argc)
 {
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
 	int portnum = 0;
 	int type, enhsp0, lowcap, highcap;
-	char *ret = 0;
+	const char *ret = NULL;
 
 	if (argc > 0)
 		portnum = strtol(argv[0], 0, 0);
@@ -378,7 +378,7 @@ static char *vlarb_table(ib_portid_t * dest, char **argv, int argc)
 	return ret;
 }
 
-static char *guid_info(ib_portid_t * dest, char **argv, int argc)
+static const char *guid_info(ib_portid_t *dest, char **argv, int argc)
 {
 	uint8_t data[IB_SMP_DATA_SIZE] = { 0 };
 	int i, j, k;
@@ -437,7 +437,7 @@ int main(int argc, char **argv)
 	int mgmt_classes[3] =
 	    { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS };
 	ib_portid_t portid = { 0 };
-	char *err;
+	const char *err;
 	op_fn_t *fn;
 	const match_rec_t *r;
 	int n;
