Skip to content

Commit ad352f9

Browse files
authored
Merge pull request pmodels#7292 from raffenet/ch3-pkt-init
ch3: Fix uninitialized bytes caused by MPIDI_Pkt_init Approved-by: Hui Zhou <[email protected]>
2 parents dbe8ae4 + bcd34e7 commit ad352f9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/mpid/ch3/include/mpidimpl.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,16 +456,22 @@ void MPIDI_DBG_PrintVCState(MPIDI_VC_t *vc);
456456
/*--------------------
457457
BEGIN PACKET SECTION
458458
--------------------*/
459-
#if !defined(MPICH_DEBUG_MEMINIT)
459+
#ifdef MPICH_DEBUG_MEMINIT
460+
#define MPIDI_PKT_INIT_VAL (0xfc)
461+
#else
462+
#define MPIDI_PKT_INIT_VAL (0)
463+
#endif
464+
#ifdef NVALGRIND
460465
# define MPIDI_Pkt_init(pkt_, type_) \
461466
{ \
462467
(pkt_)->type = (type_); \
463468
}
464469
#else
465-
# define MPIDI_Pkt_init(pkt_, type_) \
466-
{ \
467-
memset((void *) (pkt_), 0xfc, sizeof(*(pkt_))); \
468-
(pkt_)->type = (type_); \
470+
# define MPIDI_Pkt_init(pkt_, type_) \
471+
{ \
472+
memset((void *) (pkt_), MPIDI_PKT_INIT_VAL, \
473+
sizeof(MPIDI_CH3_Pkt_t)); \
474+
(pkt_)->type = (type_); \
469475
}
470476
#endif
471477

0 commit comments

Comments
 (0)