All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] qed: fix invalid use of sizeof in qed_alloc_qm_data()
@ 2017-04-25  7:07 Wei Yongjun
  2017-04-25 13:43 ` Mintz, Yuval
  2017-04-25 16:00 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2017-04-25  7:07 UTC (permalink / raw)
  To: Yuval Mintz, Ariel Elior; +Cc: Wei Yongjun, everest-linux-l2, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/qlogic/qed/qed_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index 2498785..4fa5a1e 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -820,7 +820,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)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH net-next] qed: fix invalid use of sizeof in qed_alloc_qm_data()
  2017-04-25  7:07 [PATCH net-next] qed: fix invalid use of sizeof in qed_alloc_qm_data() Wei Yongjun
@ 2017-04-25 13:43 ` Mintz, Yuval
  2017-04-25 16:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mintz, Yuval @ 2017-04-25 13:43 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Wei Yongjun, netdev, Elior, Ariel

> sizeof() when applied to a pointer typed expression gives the size of the
> pointer, not that of the pointed data.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Thanks!
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>

I'd also mention that -

Fixes: b5a9ee7cf3be ("qed: Revise QM configuration")

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] qed: fix invalid use of sizeof in qed_alloc_qm_data()
  2017-04-25  7:07 [PATCH net-next] qed: fix invalid use of sizeof in qed_alloc_qm_data() Wei Yongjun
  2017-04-25 13:43 ` Mintz, Yuval
@ 2017-04-25 16:00 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-04-25 16:00 UTC (permalink / raw)
  To: weiyj.lk; +Cc: Yuval.Mintz, Ariel.Elior, weiyongjun1, everest-linux-l2, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Tue, 25 Apr 2017 07:07:18 +0000

> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> sizeof() when applied to a pointer typed expression gives the
> size of the pointer, not that of the pointed data.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied with Yuval's Fixes: tag added.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-25 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  7:07 [PATCH net-next] qed: fix invalid use of sizeof in qed_alloc_qm_data() Wei Yongjun
2017-04-25 13:43 ` Mintz, Yuval
2017-04-25 16:00 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.