提交 447458c0 编写于 作者: D Dan Carpenter 提交者: David S. Miller

net/mlx4: off by one in parse_trans_rule()

This should be ">=" here instead of ">".  MLX4_NET_TRANS_RULE_NUM is 6.
We use "spec->id" as an array offset into the __rule_hw_sz[] and
__sw_id_hw[] arrays which have 6 elements.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NHadar Hen Zion <hadarh@mellanox.co.il>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f0396f60
......@@ -773,7 +773,7 @@ static int parse_trans_rule(struct mlx4_dev *dev, struct mlx4_spec_list *spec,
[MLX4_NET_TRANS_RULE_ID_UDP] =
sizeof(struct mlx4_net_trans_rule_hw_tcp_udp)
};
if (spec->id > MLX4_NET_TRANS_RULE_NUM) {
if (spec->id >= MLX4_NET_TRANS_RULE_NUM) {
mlx4_err(dev, "Invalid network rule id. id = %d\n", spec->id);
return -EINVAL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册