[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FFD9306.3000600@mellanox.com>
Date: Wed, 11 Jul 2012 17:51:50 +0300
From: Hadar Hen Zion <hadarh@...lanox.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: Hadar Hen Zion <hadarh@...lanox.co.il>,
"David S. Miller" <davem@...emloft.net>,
Or Gerlitz <ogerlitz@...lanox.com>,
Eugenia Emantayev <eugenia@...lanox.co.il>,
Yevgeny Petrilin <yevgenyp@...lanox.co.il>,
<netdev@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [patch] net/mlx4: off by one in parse_trans_rule()
On 7/11/2012 9:33 AM, Dan Carpenter wrote:
> 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: Dan Carpenter <dan.carpenter@...cle.com>
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
> index bc62f53..5bac0df 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
> @@ -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;
> }
>
Hi Dan,
This is indeed a bug, thanks for spotting this over,
Please add:
Acked-by: Hadar Hen Zion <hadarh@...lanox.co.il>
Hadar
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists