There are a few cases where padding may be undefined according to the C standard. Practically, it seems implementations don't have issue, but it is better to be safe. The code paths modified are not hot ones.
Found by inspection. Signed-off-by: Darrell Ball <dlu...@gmail.com> --- v3: Removed an unnecessary change and limited scope of 2 others. v2: Found another one; will double check for others later. lib/conntrack.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index e1f4041..4c8d71b 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -748,6 +748,7 @@ conn_lookup(struct conntrack *ct, const struct conn_key *key, long long now) { struct conn_lookup_ctx ctx; ctx.conn = NULL; + memset(&ctx.key, 0, sizeof ctx.key); ctx.key = *key; ctx.hash = conn_key_hash(key, ct->hash_basis); unsigned bucket = hash_to_bucket(ctx.hash); @@ -896,6 +897,7 @@ conn_not_found(struct conntrack *ct, struct dp_packet *pkt, if (nat_action_info) { nc->nat_info = xmemdup(nat_action_info, sizeof *nc->nat_info); + memset(conn_for_un_nat_copy, 0, sizeof *conn_for_un_nat_copy); if (alg_exp) { if (alg_exp->nat_rpl_dst) { @@ -934,8 +936,6 @@ conn_not_found(struct conntrack *ct, struct dp_packet *pkt, ct_rwlock_unlock(&ct->resources_lock); } conn_for_un_nat_copy->conn_type = CT_CONN_TYPE_UN_NAT; - conn_for_un_nat_copy->nat_info = NULL; - conn_for_un_nat_copy->alg = NULL; nat_packet(pkt, nc, ctx->icmp_related); } hmap_insert(&ct->buckets[bucket].connections, &nc->node, ctx->hash); @@ -1262,6 +1262,7 @@ process_one(struct conntrack *ct, struct dp_packet *pkt, ct->hash_basis, alg_src_ip_wc(ct_alg_ctl)); if (alg_exp) { + memset(&alg_exp_entry, 0, sizeof alg_exp_entry); alg_exp_entry = *alg_exp; alg_exp = &alg_exp_entry; } @@ -2614,7 +2615,9 @@ static struct alg_exp_node * expectation_lookup(struct hmap *alg_expectations, const struct conn_key *key, uint32_t basis, bool src_ip_wc) { - struct conn_key check_key = *key; + struct conn_key check_key; + memset(&check_key, 0, sizeof check_key); + check_key = *key; check_key.src.port = ALG_WC_SRC_PORT; if (src_ip_wc) { -- 1.9.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev