Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ompi/mca/coll/base/coll_base_allgatherv.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount,
{
int line = -1, err = 0, rank, size, sendto, recvfrom, distance, blockcount, i;
int *new_rcounts = NULL, *new_rdispls = NULL, *new_scounts = NULL, *new_sdispls = NULL;
ptrdiff_t slb, rlb, sext, rext;
ptrdiff_t rlb, rext;
char *tmpsend = NULL, *tmprecv = NULL;
struct ompi_datatype_t *new_rdtype, *new_sdtype;

Expand Down Expand Up @@ -226,7 +226,7 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount,
mca_coll_base_module_t *module)
{
int line = -1, rank, size, sendto, recvfrom, i, recvdatafrom, senddatafrom, err = 0;
ptrdiff_t slb, rlb, sext, rext;
ptrdiff_t rlb, rext;
char *tmpsend = NULL, *tmprecv = NULL;

size = ompi_comm_size(comm);
Expand Down Expand Up @@ -355,7 +355,7 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount,
int line = -1, rank, size, i, even_rank, err = 0;
int neighbor[2], offset_at_step[2], recv_data_from[2], send_data_from;
int new_scounts[2], new_sdispls[2], new_rcounts[2], new_rdispls[2];
ptrdiff_t slb, rlb, sext, rext;
ptrdiff_t rlb, rext;
char *tmpsend = NULL, *tmprecv = NULL;
struct ompi_datatype_t *new_rdtype, *new_sdtype;

Expand Down Expand Up @@ -500,7 +500,7 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount,
{
int line = -1, err = 0, rank, remote;
char *tmpsend = NULL, *tmprecv = NULL;
ptrdiff_t sext, rext, lb;
ptrdiff_t rext, lb;

rank = ompi_comm_rank(comm);

Expand Down
2 changes: 1 addition & 1 deletion opal/mca/btl/openib/btl_openib_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -3719,7 +3719,7 @@ static void handle_wc(mca_btl_openib_device_t* device, const uint32_t cq,
endpoint->endpoint_state = MCA_BTL_IB_FAILED;

if(IBV_WC_SEND == wc->opcode && !BTL_OPENIB_QP_TYPE_PP(qp)) {
BTL_VERBOSE(("frag %p returning %d credits", frag, 1+n));
BTL_VERBOSE(("frag %p returning %d credits", (void*) frag, 1+n));
OPAL_THREAD_FETCH_ADD32(&openib_btl->qps[qp].u.srq_qp.sd_credits, 1+n);
/* new SRQ credit available. Try to progress pending frags*/
progress_pending_frags_srq(openib_btl, qp);
Expand Down
8 changes: 4 additions & 4 deletions orte/mca/rmaps/base/rmaps_base_map_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,17 @@ void orte_rmaps_base_display_map(orte_job_t *jdata)
if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, j))) {
continue;
}
memset(tmp1, 0, 1024);
memset(tmp1, 0, sizeof(tmp1));
if (orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR)) {
if (NULL == bd) {
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
(void)strncpy(tmp1, "UNBOUND", sizeof(tmp1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this PR is closed, but you're asking me to review the PRs into release branches. This patch isn't really any better. strncpy() is not guaranteed to NULL terminate the string, so this can still cause memory corruption down stream. Better would be to explicitly set tmp1[sizeof(tmp1) - 1] = '\0'; after the strncpy() to make sure the string is NULL terminated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fixed in #5786.

} else {
if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(tmp1, sizeof(tmp1), node->topology->topo, bd->cpuset)) {
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
(void)strncpy(tmp1, "UNBOUND", sizeof(tmp1));
}
}
} else {
(void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND"));
(void)strncpy(tmp1, "UNBOUND", sizeof(tmp1));
}
opal_output(orte_clean_output, "\t\t<process rank=%s app_idx=%ld local_rank=%lu node_rank=%lu binding=%s>",
ORTE_VPID_PRINT(proc->name.vpid), (long)proc->app_idx,
Expand Down