On 01/04/2016 02:24 PM, Ben Pfaff wrote:
> A few bugs have been fixed lately that were related to struct
> ofputil_flow_mod not being fully initialized in a few places.  This commit
> changes several pieces of code from using individual assignments to fields
> in struct ofputil_flow_mod, to using whole initializers or assignments to
> a whole struct.  This should help prevent similar problems in the future.
> 
> CC: Ilya Maximets <i.maxim...@samsung.com>
> Signed-off-by: Ben Pfaff <b...@ovn.org>

Acked-by: Russell Bryant <russ...@ovn.org>

I'd be tempted to remove the initializations of fields to 0 now that
they don't matter, but I guess it doesn't hurt anything to leave them

For example,

> +        struct ofputil_flow_mod fm = {
> +            .match = MATCH_CATCHALL_INITIALIZER,
> +            .priority = 0,
> +            .cookie = 0,
> +            .cookie_mask = 0,
> +            .new_cookie = 0,
> +            .modify_cookie = false,
> +            .table_id = 0,
> +            .command = OFPFC_ADD,
> +            .idle_timeout = 0,
> +            .hard_timeout = 0,
> +            .importance = 0,
> +            .buffer_id = UINT32_MAX,
> +            .out_port = OFPP_NONE,
> +            .out_group = OFPG_ANY,
> +            .flags = 0,
> +            .ofpacts = &output.ofpact,
> +            .ofpacts_len = sizeof output,
> +            .delete_reason = 0,
> +        };

could just be:

> +        struct ofputil_flow_mod fm = {
> +            .match = MATCH_CATCHALL_INITIALIZER,
> +            .command = OFPFC_ADD,
> +            .buffer_id = UINT32_MAX,
> +            .out_port = OFPP_NONE,
> +            .out_group = OFPG_ANY,
> +            .ofpacts = &output.ofpact,
> +            .ofpacts_len = sizeof output,
> +        };

right?

-- 
Russell Bryant
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to