lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 8 Dec 2021 08:29:01 -0800
From:   Bjorn Andersson <bjorn.andersson@...aro.org>
To:     Guo Zhengkui <guozhengkui@...o.com>
Cc:     Andy Gross <agross@...nel.org>,
        Kishon Vijay Abraham I <kishon@...com>,
        Vinod Koul <vkoul@...nel.org>,
        "open list:ARM/QUALCOMM SUPPORT" <linux-arm-msm@...r.kernel.org>,
        "open list:GENERIC PHY FRAMEWORK" <linux-phy@...ts.infradead.org>,
        open list <linux-kernel@...r.kernel.org>,
        kernel <kernel@...o.com>
Subject: Re: [PATCH] phy: qcom: fix bug: application of sizeof to pointer

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@...o.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
> > > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ