mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 22:08:33 -04:00
RDMA/mlx5: Avoid flexible array warning
The following warning is reported by sparse tool: drivers/infiniband/hw/mlx5/fs.c:1664:26: warning: array of flexible structures Avoid it by simply splitting array into two separate structs. Link: https://patch.msgid.link/7b891b96a9fc053d01284c184d25ae98d35db2d4.1747827041.git.leon@kernel.org Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
committed by
Leon Romanovsky
parent
45611fe821
commit
e91fb8b9d0
@@ -1645,11 +1645,6 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
|
||||
return _create_flow_rule(dev, ft_prio, flow_attr, dst, 0, NULL);
|
||||
}
|
||||
|
||||
enum {
|
||||
LEFTOVERS_MC,
|
||||
LEFTOVERS_UC,
|
||||
};
|
||||
|
||||
static struct mlx5_ib_flow_handler *create_leftovers_rule(struct mlx5_ib_dev *dev,
|
||||
struct mlx5_ib_flow_prio *ft_prio,
|
||||
struct ib_flow_attr *flow_attr,
|
||||
@@ -1659,43 +1654,32 @@ static struct mlx5_ib_flow_handler *create_leftovers_rule(struct mlx5_ib_dev *de
|
||||
struct mlx5_ib_flow_handler *handler = NULL;
|
||||
|
||||
static struct {
|
||||
struct ib_flow_attr flow_attr;
|
||||
struct ib_flow_spec_eth eth_flow;
|
||||
} leftovers_specs[] = {
|
||||
[LEFTOVERS_MC] = {
|
||||
.flow_attr = {
|
||||
.num_of_specs = 1,
|
||||
.size = sizeof(leftovers_specs[0])
|
||||
},
|
||||
.eth_flow = {
|
||||
.type = IB_FLOW_SPEC_ETH,
|
||||
.size = sizeof(struct ib_flow_spec_eth),
|
||||
.mask = {.dst_mac = {0x1} },
|
||||
.val = {.dst_mac = {0x1} }
|
||||
}
|
||||
},
|
||||
[LEFTOVERS_UC] = {
|
||||
.flow_attr = {
|
||||
.num_of_specs = 1,
|
||||
.size = sizeof(leftovers_specs[0])
|
||||
},
|
||||
.eth_flow = {
|
||||
.type = IB_FLOW_SPEC_ETH,
|
||||
.size = sizeof(struct ib_flow_spec_eth),
|
||||
.mask = {.dst_mac = {0x1} },
|
||||
.val = {.dst_mac = {} }
|
||||
}
|
||||
}
|
||||
};
|
||||
struct ib_flow_attr flow_attr;
|
||||
} leftovers_wc = { .flow_attr = { .num_of_specs = 1,
|
||||
.size = sizeof(leftovers_wc) },
|
||||
.eth_flow = {
|
||||
.type = IB_FLOW_SPEC_ETH,
|
||||
.size = sizeof(struct ib_flow_spec_eth),
|
||||
.mask = { .dst_mac = { 0x1 } },
|
||||
.val = { .dst_mac = { 0x1 } } } };
|
||||
|
||||
handler = create_flow_rule(dev, ft_prio,
|
||||
&leftovers_specs[LEFTOVERS_MC].flow_attr,
|
||||
dst);
|
||||
static struct {
|
||||
struct ib_flow_spec_eth eth_flow;
|
||||
struct ib_flow_attr flow_attr;
|
||||
} leftovers_uc = { .flow_attr = { .num_of_specs = 1,
|
||||
.size = sizeof(leftovers_uc) },
|
||||
.eth_flow = {
|
||||
.type = IB_FLOW_SPEC_ETH,
|
||||
.size = sizeof(struct ib_flow_spec_eth),
|
||||
.mask = { .dst_mac = { 0x1 } },
|
||||
.val = { .dst_mac = {} } } };
|
||||
|
||||
handler = create_flow_rule(dev, ft_prio, &leftovers_wc.flow_attr, dst);
|
||||
if (!IS_ERR(handler) &&
|
||||
flow_attr->type == IB_FLOW_ATTR_ALL_DEFAULT) {
|
||||
handler_ucast = create_flow_rule(dev, ft_prio,
|
||||
&leftovers_specs[LEFTOVERS_UC].flow_attr,
|
||||
dst);
|
||||
&leftovers_uc.flow_attr, dst);
|
||||
if (IS_ERR(handler_ucast)) {
|
||||
mlx5_del_flow_rules(handler->rule);
|
||||
ft_prio->refcount--;
|
||||
|
||||
Reference in New Issue
Block a user