Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107656455
D25676.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D25676.diff
View Options
Index: head/contrib/ofed/infiniband-diags/src/ibdiag_common.c
===================================================================
--- head/contrib/ofed/infiniband-diags/src/ibdiag_common.c
+++ head/contrib/ofed/infiniband-diags/src/ibdiag_common.c
@@ -120,6 +120,7 @@
void read_ibdiag_config(const char *file)
{
char buf[1024];
+ char orig_buf[1024];
FILE *config_fd = NULL;
char *p_prefix, *p_last;
char *name;
@@ -142,8 +143,14 @@
if (*p_prefix == '#')
continue; /* ignore comment lines */
+ strlcpy(orig_buf, buf, sizeof(orig_buf));
name = strtok_r(p_prefix, "=", &p_last);
val_str = strtok_r(NULL, "\n", &p_last);
+ if (!name || !val_str) {
+ fprintf(stderr, "%s: malformed line in \"%s\":\n%s\n",
+ prog_name, file, orig_buf);
+ continue;
+ }
if (strncmp(name, "CA", strlen("CA")) == 0) {
free(ibd_ca);
@@ -165,6 +172,7 @@
ibd_sakey = strtoull(val_str, 0, 0);
} else if (strncmp(name, "nd_format",
strlen("nd_format")) == 0) {
+ free(ibd_nd_format);
ibd_nd_format = strdup(val_str);
}
}
Index: head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c
===================================================================
--- head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c
+++ head/contrib/ofed/infiniband-diags/src/ibdiag_sa.c
@@ -222,7 +222,7 @@
"MAD Reserved",
"MAD Reserved",
"MAD Reserved",
- "MAD Invalid value in Attribute field(s) or Attribute Modifier"
+ "MAD Invalid value in Attribute field(s) or Attribute Modifier",
"MAD UNKNOWN ERROR"
};
#define MAD_ERR_UNKNOWN (ARR_SIZE(ib_mad_inv_field_str) - 1)
Index: head/contrib/ofed/infiniband-diags/src/iblinkinfo.c
===================================================================
--- head/contrib/ofed/infiniband-diags/src/iblinkinfo.c
+++ head/contrib/ofed/infiniband-diags/src/iblinkinfo.c
@@ -293,7 +293,8 @@
printf("%s%s: %s:\n",
out_prefix ? out_prefix : "",
nodetype_str(node), remap);
- (*out_header_flag)++;
+ if (out_header_flag)
+ (*out_header_flag)++;
free(remap);
}
}
@@ -397,7 +398,7 @@
}
if (output_diff && fabric2_port) {
- print_node_header(fabric1_node,
+ print_node_header(fabric2_node,
head_print,
NULL);
print_port(fabric2_node,
Index: head/contrib/ofed/infiniband-diags/src/ibportstate.c
===================================================================
--- head/contrib/ofed/infiniband-diags/src/ibportstate.c
+++ head/contrib/ofed/infiniband-diags/src/ibportstate.c
@@ -564,6 +564,7 @@
printf("Port is already in enable state\n");
goto close_port;
}
+ /* FALLTHROUGH */
case ENABLE:
case RESET:
/* Polling */
Index: head/contrib/ofed/infiniband-diags/src/ibqueryerrors.c
===================================================================
--- head/contrib/ofed/infiniband-diags/src/ibqueryerrors.c
+++ head/contrib/ofed/infiniband-diags/src/ibqueryerrors.c
@@ -130,6 +130,7 @@
static void set_thresholds(char *threshold_file)
{
char buf[1024];
+ char orig_buf[1024];
int val = 0;
FILE *thresf = fopen(threshold_file, "r");
char *p_prefix, *p_last;
@@ -156,8 +157,14 @@
if (*p_prefix == '#')
continue; /* ignore comment lines */
+ strlcpy(orig_buf, buf, sizeof(orig_buf));
name = strtok_r(p_prefix, "=", &p_last);
val_str = strtok_r(NULL, "\n", &p_last);
+ if (!name || !val_str) {
+ fprintf(stderr, "malformed line in \"%s\":\n%s\n",
+ threshold_file, orig_buf);
+ continue;
+ }
val = strtoul(val_str, NULL, 0);
set_thres(name, val);
Index: head/contrib/ofed/infiniband-diags/src/ibroute.c
===================================================================
--- head/contrib/ofed/infiniband-diags/src/ibroute.c
+++ head/contrib/ofed/infiniband-diags/src/ibroute.c
@@ -354,6 +354,8 @@
" (%s):\n", startlid, endlid, portid2str(portid), nodeguid,
mapnd);
+ free(mapnd);
+
DEBUG("Switch top is 0x%x\n", top);
printf(" Lid Out Destination\n");
@@ -390,7 +392,6 @@
}
printf("%d %slids dumped \n", n, dump_all ? "" : "valid ");
- free(mapnd);
return 0;
}
Index: head/contrib/ofed/libibumad/umad_str.c
===================================================================
--- head/contrib/ofed/libibumad/umad_str.c
+++ head/contrib/ofed/libibumad/umad_str.c
@@ -246,7 +246,6 @@
default:
return (umad_common_attr_str(attr_id));
}
- return ("<unknown>");
}
static const char * umad_sa_attr_str(__be16 attr_id)
@@ -301,7 +300,6 @@
default:
return (umad_common_attr_str(attr_id));
}
- return ("<unknown>");
}
static const char * umad_cm_attr_str(__be16 attr_id)
@@ -336,7 +334,6 @@
default:
return (umad_common_attr_str(attr_id));
}
- return ("<unknown>");
}
const char * umad_attribute_str(uint8_t mgmt_class, __be16 attr_id)
Index: head/contrib/ofed/libibverbs/device.c
===================================================================
--- head/contrib/ofed/libibverbs/device.c
+++ head/contrib/ofed/libibverbs/device.c
@@ -264,7 +264,6 @@
{
int async_fd = context->async_fd;
int cmd_fd = context->cmd_fd;
- int cq_fd = -1;
struct verbs_context *context_ex;
struct verbs_device *verbs_device = verbs_get_device(context->device);
@@ -279,8 +278,6 @@
close(async_fd);
close(cmd_fd);
- if (abi_ver <= 2)
- close(cq_fd);
return 0;
}
Index: head/contrib/ofed/libibverbs/examples/rc_pingpong.c
===================================================================
--- head/contrib/ofed/libibverbs/examples/rc_pingpong.c
+++ head/contrib/ofed/libibverbs/examples/rc_pingpong.c
@@ -273,7 +273,11 @@
return NULL;
}
- listen(sockfd, 1);
+ if (listen(sockfd, 1)) {
+ perror("listen() failed");
+ close(sockfd);
+ return NULL;
+ }
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Index: head/contrib/ofed/libibverbs/examples/srq_pingpong.c
===================================================================
--- head/contrib/ofed/libibverbs/examples/srq_pingpong.c
+++ head/contrib/ofed/libibverbs/examples/srq_pingpong.c
@@ -283,7 +283,11 @@
return NULL;
}
- listen(sockfd, 1);
+ if (listen(sockfd, 1)) {
+ perror("listen() failed");
+ close(sockfd);
+ return NULL;
+ }
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Index: head/contrib/ofed/libibverbs/examples/uc_pingpong.c
===================================================================
--- head/contrib/ofed/libibverbs/examples/uc_pingpong.c
+++ head/contrib/ofed/libibverbs/examples/uc_pingpong.c
@@ -247,7 +247,11 @@
return NULL;
}
- listen(sockfd, 1);
+ if (listen(sockfd, 1)) {
+ perror("listen() failed");
+ close(sockfd);
+ return NULL;
+ }
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Index: head/contrib/ofed/libibverbs/examples/ud_pingpong.c
===================================================================
--- head/contrib/ofed/libibverbs/examples/ud_pingpong.c
+++ head/contrib/ofed/libibverbs/examples/ud_pingpong.c
@@ -245,7 +245,11 @@
return NULL;
}
- listen(sockfd, 1);
+ if (listen(sockfd, 1)) {
+ perror("listen() failed");
+ close(sockfd);
+ return NULL;
+ }
connfd = accept(sockfd, NULL, NULL);
close(sockfd);
if (connfd < 0) {
Index: head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c
===================================================================
--- head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c
+++ head/contrib/ofed/libibverbs/examples/xsrq_pingpong.c
@@ -630,7 +630,11 @@
return 1;
}
- listen(sockfd, ctx.num_clients);
+ if (listen(sockfd, ctx.num_clients)) {
+ perror("listen() failed");
+ close(sockfd);
+ return 1;
+ }
for (i = 0; i < ctx.num_clients; i++) {
connfd = accept(sockfd, NULL, NULL);
Index: head/contrib/ofed/libmlx5/bitmap.h
===================================================================
--- head/contrib/ofed/libmlx5/bitmap.h
+++ head/contrib/ofed/libmlx5/bitmap.h
@@ -95,17 +95,17 @@
static inline void mlx5_set_bit(unsigned int nr, unsigned long *addr)
{
- addr[(nr / BITS_PER_LONG)] |= (1 << (nr % BITS_PER_LONG));
+ addr[(nr / BITS_PER_LONG)] |= (1UL << (nr % BITS_PER_LONG));
}
-static inline void mlx5_clear_bit(unsigned int nr, unsigned long *addr)
+static inline void mlx5_clear_bit(unsigned int nr, unsigned long *addr)
{
- addr[(nr / BITS_PER_LONG)] &= ~(1 << (nr % BITS_PER_LONG));
+ addr[(nr / BITS_PER_LONG)] &= ~(1UL << (nr % BITS_PER_LONG));
}
static inline int mlx5_test_bit(unsigned int nr, const unsigned long *addr)
{
- return !!(addr[(nr / BITS_PER_LONG)] & (1 << (nr % BITS_PER_LONG)));
+ return !!(addr[(nr / BITS_PER_LONG)] & (1UL << (nr % BITS_PER_LONG)));
}
#endif
Index: head/contrib/ofed/librdmacm/examples/mckey.c
===================================================================
--- head/contrib/ofed/librdmacm/examples/mckey.c
+++ head/contrib/ofed/librdmacm/examples/mckey.c
@@ -469,8 +469,7 @@
sib = (struct sockaddr_ib *) addr;
memset(sib, 0, sizeof *sib);
sib->sib_family = AF_IB;
- inet_pton(AF_INET6, dst, &sib->sib_addr);
- return 0;
+ return inet_pton(AF_INET6, dst, &sib->sib_addr) != 1;
}
static int run(void)
Index: head/contrib/ofed/opensm/opensm/osm_perfmgr.c
===================================================================
--- head/contrib/ofed/opensm/opensm/osm_perfmgr.c
+++ head/contrib/ofed/opensm/opensm/osm_perfmgr.c
@@ -1935,7 +1935,9 @@
pm->state =
p_opt->perfmgr ? PERFMGR_STATE_ENABLED : PERFMGR_STATE_DISABLE;
pm->sweep_state = PERFMGR_SWEEP_SLEEP;
- cl_spinlock_init(&pm->lock);
+ status = cl_spinlock_init(&pm->lock);
+ if (status != IB_SUCCESS)
+ goto Exit;
pm->sweep_time_s = p_opt->perfmgr_sweep_time_s;
pm->max_outstanding_queries = p_opt->perfmgr_max_outstanding_queries;
pm->ignore_cas = p_opt->perfmgr_ignore_cas;
Index: head/contrib/ofed/opensm/opensm/osm_port.c
===================================================================
--- head/contrib/ofed/opensm/opensm/osm_port.c
+++ head/contrib/ofed/opensm/opensm/osm_port.c
@@ -161,8 +161,10 @@
only the singular part that has this GUID is owned.
*/
p_physp = osm_node_get_physp_ptr(p_parent_node, port_num);
- if (!p_physp)
+ if (!p_physp) {
+ osm_port_delete(&p_port);
return NULL;
+ }
CL_ASSERT(port_guid == osm_physp_get_port_guid(p_physp));
p_port->p_physp = p_physp;
Index: head/contrib/ofed/opensm/opensm/osm_sa_mad_ctrl.c
===================================================================
--- head/contrib/ofed/opensm/opensm/osm_sa_mad_ctrl.c
+++ head/contrib/ofed/opensm/opensm/osm_sa_mad_ctrl.c
@@ -373,6 +373,7 @@
case IB_MAD_METHOD_GETMULTI:
#endif
is_get_request = TRUE;
+ /* FALLTHROUGH */
case IB_MAD_METHOD_SET:
case IB_MAD_METHOD_DELETE:
/* if we are closing down simply do nothing */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 6:30 AM (16 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15851381
Default Alt Text
D25676.diff (10 KB)
Attached To
Mode
D25676: Fix Coverity issues in OFED
Attached
Detach File
Event Timeline
Log In to Comment