qed: fix invalid use of sizeof in qed_alloc_qm_data()
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 25 Apr 2017 07:07:18 +0000 (07:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Apr 2017 15:59:36 +0000 (11:59 -0400)
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: b5a9ee7cf3be ("qed: Revise QM configuration")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_dev.c

index f168b718594b398ee3a3b3a6f4d11e537b779ce8..ea7931b85879715fef28086530ba889eb9ba9d5c 100644 (file)
@@ -821,7 +821,7 @@ static int qed_alloc_qm_data(struct qed_hwfn *p_hwfn)
        if (!qm_info->qm_vport_params)
                goto alloc_err;
 
-       qm_info->qm_port_params = kzalloc(sizeof(qm_info->qm_port_params) *
+       qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) *
                                          p_hwfn->cdev->num_ports_in_engines,
                                          GFP_KERNEL);
        if (!qm_info->qm_port_params)