}
 
 static int parse_flow_attr(u32 *match_c, u32 *match_v,
-                          union ib_flow_spec *ib_spec)
+                          const union ib_flow_spec *ib_spec)
 {
        void *outer_headers_c = MLX5_ADDR_OF(fte_match_param, match_c,
                                             outer_headers);
               is_multicast_ether_addr(eth_spec->val.dst_mac);
 }
 
-static bool is_valid_attr(struct ib_flow_attr *flow_attr)
+static bool is_valid_attr(const struct ib_flow_attr *flow_attr)
 {
        union ib_flow_spec *ib_spec = (union ib_flow_spec *)(flow_attr + 1);
        bool has_ipv4_spec = false;
 
 static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
                                                     struct mlx5_ib_flow_prio *ft_prio,
-                                                    struct ib_flow_attr *flow_attr,
+                                                    const struct ib_flow_attr *flow_attr,
                                                     struct mlx5_flow_destination *dst)
 {
        struct mlx5_flow_table  *ft = ft_prio->flow_table;
        struct mlx5_ib_flow_handler *handler;
        struct mlx5_flow_spec *spec;
-       void *ib_flow = flow_attr + 1;
+       const void *ib_flow = (const void *)flow_attr + sizeof(*flow_attr);
        unsigned int spec_index;
        u32 action;
        int err = 0;