* [PATCH] phy: qcom: fix bug: application of sizeof to pointer
@ 2021-12-07 13:16 ` Guo Zhengkui
0 siblings, 0 replies; 14+ messages in thread
From: Guo Zhengkui @ 2021-12-07 13:16 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list
Cc: kernel, Guo Zhengkui
Fix following coccicheck error:
./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
ERROR: application of sizeof to pointer.
Use sizeof(*data) instead.
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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.20.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer
2021-12-07 13:16 ` Guo Zhengkui
@ 2021-12-07 15:13 ` Bjorn Andersson
-1 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2021-12-07 15:13 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On Tue 07 Dec 05:16 PST 2021, Guo Zhengkui wrote:
> Fix following coccicheck error:
> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> ERROR: application of sizeof to pointer.
>
> Use sizeof(*data) instead.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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);
Ouch, thanks for catching that!
But the clk_hw_onecell_data actually has a variable size array at the
end and as you can see further down I store 2 items in that array.
So that sizeof should be struct_size(data, hws, 2)
Would you be willing to update your patch with that?
And please add:
Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
Regards,
Bjorn
> if (!data)
> return -ENOMEM;
>
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer
@ 2021-12-07 15:13 ` Bjorn Andersson
0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2021-12-07 15:13 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On Tue 07 Dec 05:16 PST 2021, Guo Zhengkui wrote:
> Fix following coccicheck error:
> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> ERROR: application of sizeof to pointer.
>
> Use sizeof(*data) instead.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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);
Ouch, thanks for catching that!
But the clk_hw_onecell_data actually has a variable size array at the
end and as you can see further down I store 2 items in that array.
So that sizeof should be struct_size(data, hws, 2)
Would you be willing to update your patch with that?
And please add:
Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
Regards,
Bjorn
> if (!data)
> return -ENOMEM;
>
> --
> 2.20.1
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <AO6AKgBME5Y4PNQLIg0Wlap9.9.1638889943341.Hmail.guozhengkui@vivo.com.@PFlhOTZLT3luc080NzhjVnhAcmlwcGVyPg==>]
* Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer
[not found] ` <AO6AKgBME5Y4PNQLIg0Wlap9.9.1638889943341.Hmail.guozhengkui@vivo.com.@PFlhOTZLT3luc080NzhjVnhAcmlwcGVyPg==>
@ 2021-12-08 6:56 ` Guo Zhengkui
0 siblings, 0 replies; 14+ messages in thread
From: Guo Zhengkui @ 2021-12-08 6:56 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On 2021/12/7 23:13, Bjorn Andersson wrote:
> On Tue 07 Dec 05:16 PST 2021, Guo Zhengkui wrote:
>
>> Fix following coccicheck error:
>> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
>> ERROR: application of sizeof to pointer.
>>
>> Use sizeof(*data) instead.
>>
>> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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);
>
> Ouch, thanks for catching that!
>
> But the clk_hw_onecell_data actually has a variable size array at the
> end and as you can see further down I store 2 items in that array.
>
> So that sizeof should be struct_size(data, hws, 2)
>
> Would you be willing to update your patch with that?
>
OK, I will commit another patch. Do you mind I add a "Suggested-by" tag
of your name in the new patch?
Zhengkui
> And please add:
> Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
>
> Regards,
> Bjorn
>
>> if (!data)
>> return -ENOMEM;
>>
>> --
>> 2.20.1
>>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer
@ 2021-12-08 6:56 ` Guo Zhengkui
0 siblings, 0 replies; 14+ messages in thread
From: Guo Zhengkui @ 2021-12-08 6:56 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On 2021/12/7 23:13, Bjorn Andersson wrote:
> On Tue 07 Dec 05:16 PST 2021, Guo Zhengkui wrote:
>
>> Fix following coccicheck error:
>> ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
>> ERROR: application of sizeof to pointer.
>>
>> Use sizeof(*data) instead.
>>
>> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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);
>
> Ouch, thanks for catching that!
>
> But the clk_hw_onecell_data actually has a variable size array at the
> end and as you can see further down I store 2 items in that array.
>
> So that sizeof should be struct_size(data, hws, 2)
>
> Would you be willing to update your patch with that?
>
OK, I will commit another patch. Do you mind I add a "Suggested-by" tag
of your name in the new patch?
Zhengkui
> And please add:
> Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
>
> Regards,
> Bjorn
>
>> if (!data)
>> return -ENOMEM;
>>
>> --
>> 2.20.1
>>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer
2021-12-08 6:56 ` Guo Zhengkui
@ 2021-12-08 16:29 ` Bjorn Andersson
-1 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2021-12-08 16:29 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On Tue 07 Dec 22:56 PST 2021, Guo Zhengkui wrote:
> On 2021/12/7 23:13, Bjorn Andersson wrote:
> > On Tue 07 Dec 05:16 PST 2021, Guo Zhengkui wrote:
> >
> > > Fix following coccicheck error:
> > > ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> > > ERROR: application of sizeof to pointer.
> > >
> > > Use sizeof(*data) instead.
> > >
> > > Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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);
> >
> > Ouch, thanks for catching that!
> >
> > But the clk_hw_onecell_data actually has a variable size array at the
> > end and as you can see further down I store 2 items in that array.
> >
> > So that sizeof should be struct_size(data, hws, 2)
> >
> > Would you be willing to update your patch with that?
> >
>
> OK, I will commit another patch. Do you mind I add a "Suggested-by" tag of
> your name in the new patch?
>
I don't mind.
Regards,
Bjorn
> Zhengkui
>
> > And please add:
> > Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
> >
> > Regards,
> > Bjorn
> >
> > > if (!data)
> > > return -ENOMEM;
> > > --
> > > 2.20.1
> > >
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer
@ 2021-12-08 16:29 ` Bjorn Andersson
0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2021-12-08 16:29 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On Tue 07 Dec 22:56 PST 2021, Guo Zhengkui wrote:
> On 2021/12/7 23:13, Bjorn Andersson wrote:
> > On Tue 07 Dec 05:16 PST 2021, Guo Zhengkui wrote:
> >
> > > Fix following coccicheck error:
> > > ./drivers/phy/qualcomm/phy-qcom-edp.c:574:31-37:
> > > ERROR: application of sizeof to pointer.
> > >
> > > Use sizeof(*data) instead.
> > >
> > > Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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);
> >
> > Ouch, thanks for catching that!
> >
> > But the clk_hw_onecell_data actually has a variable size array at the
> > end and as you can see further down I store 2 items in that array.
> >
> > So that sizeof should be struct_size(data, hws, 2)
> >
> > Would you be willing to update your patch with that?
> >
>
> OK, I will commit another patch. Do you mind I add a "Suggested-by" tag of
> your name in the new patch?
>
I don't mind.
Regards,
Bjorn
> Zhengkui
>
> > And please add:
> > Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
> >
> > Regards,
> > Bjorn
> >
> > > if (!data)
> > > return -ENOMEM;
> > > --
> > > 2.20.1
> > >
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] phy: qcom: use struct_size instead of sizeof
2021-12-07 13:16 ` Guo Zhengkui
@ 2021-12-09 3:21 ` Guo Zhengkui
-1 siblings, 0 replies; 14+ messages in thread
From: Guo Zhengkui @ 2021-12-09 3:21 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list
Cc: kernel, Guo Zhengkui
Use struct_size() to get the accurate size of `clk_hw_onecell_data`
with a variable size array, instead of sizeof(data) to get the size
of a pointer.
Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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..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.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH] phy: qcom: use struct_size instead of sizeof
@ 2021-12-09 3:21 ` Guo Zhengkui
0 siblings, 0 replies; 14+ messages in thread
From: Guo Zhengkui @ 2021-12-09 3:21 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list
Cc: kernel, Guo Zhengkui
Use struct_size() to get the accurate size of `clk_hw_onecell_data`
with a variable size array, instead of sizeof(data) to get the size
of a pointer.
Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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..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.20.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: use struct_size instead of sizeof
2021-12-09 3:21 ` Guo Zhengkui
@ 2021-12-09 4:50 ` Bjorn Andersson
-1 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2021-12-09 4:50 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On Wed 08 Dec 19:21 PST 2021, Guo Zhengkui wrote:
> Use struct_size() to get the accurate size of `clk_hw_onecell_data`
> with a variable size array, instead of sizeof(data) to get the size
> of a pointer.
>
Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Thanks,
Bjorn
> Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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..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.20.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: use struct_size instead of sizeof
@ 2021-12-09 4:50 ` Bjorn Andersson
0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2021-12-09 4:50 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Kishon Vijay Abraham I, Vinod Koul,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On Wed 08 Dec 19:21 PST 2021, Guo Zhengkui wrote:
> Use struct_size() to get the accurate size of `clk_hw_onecell_data`
> with a variable size array, instead of sizeof(data) to get the size
> of a pointer.
>
Fixes: f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Thanks,
Bjorn
> Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.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..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.20.1
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: use struct_size instead of sizeof
2021-12-09 3:21 ` Guo Zhengkui
@ 2021-12-09 11:55 ` Vinod Koul
-1 siblings, 0 replies; 14+ messages in thread
From: Vinod Koul @ 2021-12-09 11:55 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On 09-12-21, 11:21, Guo Zhengkui wrote:
> Use struct_size() to get the accurate size of `clk_hw_onecell_data`
> with a variable size array, instead of sizeof(data) to get the size
> of a pointer.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] phy: qcom: use struct_size instead of sizeof
@ 2021-12-09 11:55 ` Vinod Koul
0 siblings, 0 replies; 14+ messages in thread
From: Vinod Koul @ 2021-12-09 11:55 UTC (permalink / raw)
To: Guo Zhengkui
Cc: Andy Gross, Bjorn Andersson, Kishon Vijay Abraham I,
open list:ARM/QUALCOMM SUPPORT, open list:GENERIC PHY FRAMEWORK,
open list, kernel
On 09-12-21, 11:21, Guo Zhengkui wrote:
> Use struct_size() to get the accurate size of `clk_hw_onecell_data`
> with a variable size array, instead of sizeof(data) to get the size
> of a pointer.
Applied, thanks
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 14+ messages in thread