diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2013-11-07 05:19:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-07 19:22:47 -0500 |
commit | 571b8b92c7d4cddd899cf19f11f14fb149968898 (patch) | |
tree | e89b424be4ee510fe2f508331306b9175b02f9b6 /drivers/net/ethernet/mellanox/mlx4/mcg.c | |
parent | 75a353d4761ae25f5b7676720bab81a8ad2abf0b (diff) |
net/mlx4_core: Initialize all mailbox buffers to zero before use
To guarantee that all unused fields in all FW commands for both inboxes
and outboxes are zeroed out, initialize the mailbox buffer to all zeroes.
This is especially important for SRIOV comm-channel virtual commands
(such as QUERY_FUNC_CAP), where if new fields are added to support new
features, the driver can depend on older kernels passing zeroes in these
fields.
In addition to zeroing out the mailbox buffer at allocation time, all
(now unnecessary) calls to memset by the callers of
mlx4_alloc_cmd_mailbox() are removed.
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/mcg.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mcg.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index 70f0213d68c4..acf9d5f1f922 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -506,7 +506,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 port, | |||
506 | goto out_list; | 506 | goto out_list; |
507 | } | 507 | } |
508 | mgm = mailbox->buf; | 508 | mgm = mailbox->buf; |
509 | memset(mgm, 0, sizeof *mgm); | ||
510 | members_count = 0; | 509 | members_count = 0; |
511 | list_for_each_entry(dqp, &s_steer->promisc_qps[steer], list) | 510 | list_for_each_entry(dqp, &s_steer->promisc_qps[steer], list) |
512 | mgm->qp[members_count++] = cpu_to_be32(dqp->qpn & MGM_QPN_MASK); | 511 | mgm->qp[members_count++] = cpu_to_be32(dqp->qpn & MGM_QPN_MASK); |
@@ -857,7 +856,6 @@ int mlx4_flow_attach(struct mlx4_dev *dev, | |||
857 | if (IS_ERR(mailbox)) | 856 | if (IS_ERR(mailbox)) |
858 | return PTR_ERR(mailbox); | 857 | return PTR_ERR(mailbox); |
859 | 858 | ||
860 | memset(mailbox->buf, 0, sizeof(struct mlx4_net_trans_rule_hw_ctrl)); | ||
861 | trans_rule_ctrl_to_hw(rule, mailbox->buf); | 859 | trans_rule_ctrl_to_hw(rule, mailbox->buf); |
862 | 860 | ||
863 | size += sizeof(struct mlx4_net_trans_rule_hw_ctrl); | 861 | size += sizeof(struct mlx4_net_trans_rule_hw_ctrl); |