linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pyh: qcom: fix the application of sizeof to pointer
@ 2021-12-10  6:21 davidcomponentone
  2021-12-14  9:26 ` Vinod Koul
  0 siblings, 1 reply; 5+ messages in thread
From: davidcomponentone @ 2021-12-10  6:21 UTC (permalink / raw)
  To: agross
  Cc: bjorn.andersson, davidcomponentone, kishon, vkoul, linux-arm-msm,
	linux-phy, linux-kernel, Yang Guang, Zeal Robot

From: Yang Guang <yang.guang5@zte.com.cn>

The coccinelle check report:
./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
ERROR: application of sizeof to pointer

Using the real size to fix it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
index 17d5653b661d..a8ecd2e8442d 100644
--- a/drivers/phy/qualcomm/phy-qcom-edp.c
+++ b/drivers/phy/qualcomm/phy-qcom-edp.c
@@ -571,7 +571,7 @@ static int qcom_edp_clks_register(struct qcom_edp *edp, struct device_node *np)
 	struct clk_init_data init = { };
 	int ret;
 
-	data = devm_kzalloc(edp->dev, sizeof(data), GFP_KERNEL);
+	data = devm_kzalloc(edp->dev, struct_size(data, hws, 2), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-- 
2.30.2


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

* Re: [PATCH] pyh: qcom: fix the application of sizeof to pointer
  2021-12-10  6:21 [PATCH] pyh: qcom: fix the application of sizeof to pointer davidcomponentone
@ 2021-12-14  9:26 ` Vinod Koul
  2021-12-14 10:17   ` David Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2021-12-14  9:26 UTC (permalink / raw)
  To: davidcomponentone
  Cc: agross, bjorn.andersson, kishon, linux-arm-msm, linux-phy,
	linux-kernel, Yang Guang, Zeal Robot

On 10-12-21, 14:21, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
> 
> The coccinelle check report:
> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> ERROR: application of sizeof to pointer

- this should be tagged v2
- You should always note the changes done in v2 (after the --- line)
- subsystem name is 'phy' and not pyh
- I have already applied fix e87f13c33e126ab2c72f9acb5ae98fbb93ddfd32

-- 
~Vinod

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

* Re: [PATCH] pyh: qcom: fix the application of sizeof to pointer
  2021-12-14  9:26 ` Vinod Koul
@ 2021-12-14 10:17   ` David Yang
  0 siblings, 0 replies; 5+ messages in thread
From: David Yang @ 2021-12-14 10:17 UTC (permalink / raw)
  To: Vinod Koul
  Cc: agross, bjorn.andersson, kishon, linux-arm-msm, linux-phy,
	linux-kernel, Yang Guang, Zeal Robot

Sorry about that. Thank you for your advice.

On Tue, Dec 14, 2021 at 02:56:35PM +0530, Vinod Koul wrote:
> On 10-12-21, 14:21, davidcomponentone@gmail.com wrote:
> > From: Yang Guang <yang.guang5@zte.com.cn>
> > 
> > The coccinelle check report:
> > ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> > ERROR: application of sizeof to pointer
> 
> - this should be tagged v2
> - You should always note the changes done in v2 (after the --- line)
> - subsystem name is 'phy' and not pyh
> - I have already applied fix e87f13c33e126ab2c72f9acb5ae98fbb93ddfd32
> 
> -- 
> ~Vinod

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

* Re: [PATCH] pyh: qcom: fix the application of sizeof to pointer
  2021-12-08  1:03 davidcomponentone
@ 2021-12-08  5:16 ` Bjorn Andersson
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2021-12-08  5:16 UTC (permalink / raw)
  To: davidcomponentone
  Cc: agross, kishon, vkoul, linux-arm-msm, linux-phy, linux-kernel,
	Zeal Robot, Yang Guang

On Tue 07 Dec 17:03 PST 2021, davidcomponentone@gmail.com wrote:

> From: David Yang <davidcomponentone@gmail.com>
> 
> The coccinelle check report:
> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> ERROR: application of sizeof to pointer
> 
> Using the real size to fix it.
> 

Thanks for the fix David.

Please see my answer here
https://lore.kernel.org/all/Ya96KOynsO478cVx@ripper/

Regards,
Bjorn

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> Signed-off-by: David Yang <davidcomponentone@gmail.com>
> ---
>  drivers/phy/qualcomm/phy-qcom-edp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
> index 17d5653b661d..5fe4eab9cac1 100644
> --- a/drivers/phy/qualcomm/phy-qcom-edp.c
> +++ b/drivers/phy/qualcomm/phy-qcom-edp.c
> @@ -571,7 +571,7 @@ static int qcom_edp_clks_register(struct qcom_edp *edp, struct device_node *np)
>  	struct clk_init_data init = { };
>  	int ret;
>  
> -	data = devm_kzalloc(edp->dev, sizeof(data), GFP_KERNEL);
> +	data = devm_kzalloc(edp->dev, sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> -- 
> 2.30.2
> 

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

* [PATCH] pyh: qcom: fix the application of sizeof to pointer
@ 2021-12-08  1:03 davidcomponentone
  2021-12-08  5:16 ` Bjorn Andersson
  0 siblings, 1 reply; 5+ messages in thread
From: davidcomponentone @ 2021-12-08  1:03 UTC (permalink / raw)
  To: agross
  Cc: davidcomponentone, bjorn.andersson, kishon, vkoul, linux-arm-msm,
	linux-phy, linux-kernel, Zeal Robot, Yang Guang

From: David Yang <davidcomponentone@gmail.com>

The coccinelle check report:
./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
ERROR: application of sizeof to pointer

Using the real size to fix it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
index 17d5653b661d..5fe4eab9cac1 100644
--- a/drivers/phy/qualcomm/phy-qcom-edp.c
+++ b/drivers/phy/qualcomm/phy-qcom-edp.c
@@ -571,7 +571,7 @@ static int qcom_edp_clks_register(struct qcom_edp *edp, struct device_node *np)
 	struct clk_init_data init = { };
 	int ret;
 
-	data = devm_kzalloc(edp->dev, sizeof(data), GFP_KERNEL);
+	data = devm_kzalloc(edp->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-- 
2.30.2


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

end of thread, other threads:[~2021-12-14 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10  6:21 [PATCH] pyh: qcom: fix the application of sizeof to pointer davidcomponentone
2021-12-14  9:26 ` Vinod Koul
2021-12-14 10:17   ` David Yang
  -- strict thread matches above, loose matches on Subject: below --
2021-12-08  1:03 davidcomponentone
2021-12-08  5:16 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).