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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Nov 2021 11:51:37 +0530
From:   Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To:     Bjorn Helgaas <helgaas@...nel.org>
Cc:     lorenzo.pieralisi@....com, bhelgaas@...gle.com,
        svarbanov@...sol.com, bjorn.andersson@...aro.org, robh@...nel.org,
        linux-pci@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] PCI: qcom: Fix warning generated due to the incorrect
 data type

Hi Bjorn,

On Mon, Nov 29, 2021 at 09:36:14PM -0600, Bjorn Helgaas wrote:
> On Wed, Nov 24, 2021 at 07:34:24PM +0530, Manivannan Sadhasivam wrote:
> > Fix the below sparse warning due to the use of incorrect initializer
> > data type (u16) for bdf_be variable that receives the return value of
> > cpu_to_be16(). The correct type should be __be16.
> 
> I think the patch looks OK, but the reason to change this is not to
> "fix the warning".  The reason is to fix the *problem*, i.e.,
> cpu_to_be16() returns "__be16", which is incompatible with "u16".
> 
> The warning is only a helpful hint, and should not be part of the
> subject line.  "cpu_to_be16" or "iommu-map" would be much more
> useful information in the subject.
> 

okay

> I'm also curious why pcie-qcom.c is the only driver that does this.
> "iommu-map" is not specific to qcom, but no other drivers do similar
> things with it.
> 

Yes, on the recent qcom platforms starting from sm8250 we need to program
the BDF to SID mapping in the controller and that's the reason we are
extracting the "iommu-map" property in DT.

Thanks,
Mani

> > sparse warnings: (new ones prefixed by >>)
> > >> drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] bdf_be @@     got restricted __be16 [usertype] @@
> >    drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse:     expected unsigned short [usertype] bdf_be
> >    drivers/pci/controller/dwc/pcie-qcom.c:1305:30: sparse:     got restricted __be16 [usertype]
> > 
> > Reported-by: kernel test robot <lkp@...el.com>
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> > ---
> >  drivers/pci/controller/dwc/pcie-qcom.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> > index 8a7a300163e5..6c3b034e9946 100644
> > --- a/drivers/pci/controller/dwc/pcie-qcom.c
> > +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> > @@ -1312,7 +1312,7 @@ static int qcom_pcie_config_sid_sm8250(struct qcom_pcie *pcie)
> >  
> >  	/* Look for an available entry to hold the mapping */
> >  	for (i = 0; i < nr_map; i++) {
> > -		u16 bdf_be = cpu_to_be16(map[i].bdf);
> > +		__be16 bdf_be = cpu_to_be16(map[i].bdf);
> >  		u32 val;
> >  		u8 hash;
> >  
> > -- 
> > 2.25.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ