From: Justin Pettit Date: Thu, 27 Sep 2018 17:26:01 +0000 (-0700) Subject: ofproto-dpif-xlate.c: Fix uninitialized variable warning. X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=dc2c9ce38748c506ac67e1adfe52eef154e6fda2;p=ovs.git ofproto-dpif-xlate.c: Fix uninitialized variable warning. With gcc 7.3.0 a warning is given about two variables possibly being uninitialized in compose_sample_action(). The code path only allows the variables to be used if they've been initialized, so this warning is incorrect. However, this change allows a clean build. Signed-off-by: Justin Pettit Acked-by: Flavio Leitner --- diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 2195ea353..84cce811b 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3068,7 +3068,7 @@ compose_sample_action(struct xlate_ctx *ctx, /* When meter action is not required, avoid generate sample action * for 100% sampling rate. */ bool is_sample = probability < UINT32_MAX || meter_id != UINT32_MAX; - size_t sample_offset, actions_offset; + size_t sample_offset = 0, actions_offset = 0; if (is_sample) { sample_offset = nl_msg_start_nested(ctx->odp_actions, OVS_ACTION_ATTR_SAMPLE);