]> git.proxmox.com Git - ovs.git/commitdiff
ofproto-dpif-xlate.c: Fix uninitialized variable warning.
authorJustin Pettit <jpettit@ovn.org>
Thu, 27 Sep 2018 17:26:01 +0000 (10:26 -0700)
committerJustin Pettit <jpettit@ovn.org>
Thu, 27 Sep 2018 17:57:09 +0000 (10:57 -0700)
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 <jpettit@ovn.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
ofproto/ofproto-dpif-xlate.c

index 2195ea3537b9da32b77d30ac159cbe9da3c14afb..84cce811bd1c7ea7f8fdf0845f98e0ce887292a2 100644 (file)
@@ -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);