Message ID | 1401029702-22267-1-git-send-email-rajesh.borundia@qlogic.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Rajesh Borundia <rajesh.borundia@qlogic.com> Date: Sun, 25 May 2014 10:55:02 -0400 > o Uninitialized fields in mailbox command structure > caused commands to time out randomly due to garbage > values, so initialize it to zero. > > Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> The reason you ran into this problem is that some callers clear out the command structure, and some do not. And after your change it's even more confusing, because it is not clear at all who is responsible for this initialization. In my opinion it is better to have the place that allocates the memory perform the initialization. This means for interfaces that take on-stack references from their caller, the caller does it. This also avoids situations (which currently isn't happening here) where error codes cause early function exits and as a result the passed in variable isn't cleared out. It also makes it so that the compiler can %100 see that the entire object is initialized before being used, in all code paths. Therefore, please change this bug fix to instead add the appropriate memset()'s to qlcnic_sriov_get_vf_acl(), qlcnic_sriov_channel_cfg_cmd(), and qlcnic_sriov_cfg_vf_guest_vlan(). Thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 6afe9c1..15f4c9e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -702,6 +702,7 @@ static int qlcnic_sriov_alloc_bc_mbx_args(struct qlcnic_cmd_args *mbx, u32 type) const struct qlcnic_mailbox_metadata *mbx_tbl; int i, size; + memset(mbx, 0, sizeof(*mbx)); mbx_tbl = qlcnic_sriov_bc_mbx_tbl; size = ARRAY_SIZE(qlcnic_sriov_bc_mbx_tbl);
o Uninitialized fields in mailbox command structure caused commands to time out randomly due to garbage values, so initialize it to zero. Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> --- .../ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)