Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1630223 > unrolled thread

[PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()

Started byWei Yongjun <weiyj.lk@gmail.com>
First post2017-04-25 09:00 +0200
Last post2017-04-25 10:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init() Wei Yongjun <weiyj.lk@gmail.com> - 2017-04-25 09:00 +0200
    Re: [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in  qcom_qmp_phy_vreg_init() Vivek Gautam <vivek.gautam@codeaurora.org> - 2017-04-25 10:20 +0200

#1630223 — [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()

FromWei Yongjun <weiyj.lk@gmail.com>
Date2017-04-25 09:00 +0200
Subject[PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()
Message-ID<tA2C5-1bC-5@gated-at.bofh.it>
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/phy/phy-qcom-qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
index 727e23b..7d6085f 100644
--- a/drivers/phy/phy-qcom-qmp.c
+++ b/drivers/phy/phy-qcom-qmp.c
@@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev)
 	int num = qmp->cfg->num_vregs;
 	int i;
 
-	qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL);
+	qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
 	if (!qmp->vregs)
 		return -ENOMEM;

[toc] | [next] | [standalone]


#1630282 — Re: [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()

FromVivek Gautam <vivek.gautam@codeaurora.org>
Date2017-04-25 10:20 +0200
SubjectRe: [PATCH -next] phy: qcom-qmp: fix invalid use of sizeof in qcom_qmp_phy_vreg_init()
Message-ID<tA3Rx-28G-27@gated-at.bofh.it>
In reply to#1630223
Hi,


On 04/25/2017 12:27 PM, Wei Yongjun wrote:
> 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>
> ---

Apparently Kbuild had caught this and sent a similar patch. But I missed
that.

Thank you for the patch. I have requested Kishon to pull in the patch
from Kbuild along with your patch [1] fixing the return value for of_iomap.

[1] https://lkml.org/lkml/2017/4/24/1080

Best Regards
Vivek

>   drivers/phy/phy-qcom-qmp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/phy/phy-qcom-qmp.c b/drivers/phy/phy-qcom-qmp.c
> index 727e23b..7d6085f 100644
> --- a/drivers/phy/phy-qcom-qmp.c
> +++ b/drivers/phy/phy-qcom-qmp.c
> @@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev)
>   	int num = qmp->cfg->num_vregs;
>   	int i;
>   
> -	qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL);
> +	qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
>   	if (!qmp->vregs)
>   		return -ENOMEM;
>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web