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:   Fri, 4 Mar 2022 14:29:39 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Marc Zyngier <maz@...nel.org>
CC:     "cgel.zte@...il.com" <cgel.zte@...il.com>,
        "mpe@...erman.id.au" <mpe@...erman.id.au>,
        Zeal Robot <zealci@....com.cn>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Minghao Chi <chi.minghao@....com.cn>,
        "jgg@...pe.ca" <jgg@...pe.ca>,
        "paulus@...ba.org" <paulus@...ba.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH] powerpc/sysdev: Use of_device_get_match_data()



Le 04/03/2022 à 15:26, Marc Zyngier a écrit :
> On Fri, 04 Mar 2022 13:10:19 +0000,
> Christophe Leroy <christophe.leroy@...roup.eu> wrote:
>>
>>
>>
>> Le 04/03/2022 à 02:18, cgel.zte@...il.com a écrit :
>>> From: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
>>>
>>> Use of_device_get_match_data() to simplify the code.
>>>
>>> Reported-by: Zeal Robot <zealci@....com.cn>
>>> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
>>> ---
>>>    arch/powerpc/sysdev/fsl_msi.c | 6 +-----
>>>    1 file changed, 1 insertion(+), 5 deletions(-)
>>>
>>> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
>>> index b3475ae9f236..9d135bbb30b7 100644
>>> --- a/arch/powerpc/sysdev/fsl_msi.c
>>> +++ b/arch/powerpc/sysdev/fsl_msi.c
>>> @@ -387,7 +387,6 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
>>>    static const struct of_device_id fsl_of_msi_ids[];
>>>    static int fsl_of_msi_probe(struct platform_device *dev)
>>>    {
>>> -	const struct of_device_id *match;
>>>    	struct fsl_msi *msi;
>>>    	struct resource res, msiir;
>>>    	int err, i, j, irq_index, count;
>>> @@ -397,10 +396,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
>>>    	u32 offset;
>>>    	struct pci_controller *phb;
>>>    
>>> -	match = of_match_device(fsl_of_msi_ids, &dev->dev);
>>> -	if (!match)
>>> -		return -EINVAL;
>>> -	features = match->data;
>>> +	features = of_device_get_match_data(&dev->dev);
>>
>> What happens when features is NULL ?
> 
> I did jump at that one too, but as it turns out, it cannot happen, by
> construction. All the fsl_of_msi_ids[] entries have a non-NULL .data
> pointer, and you only enter probe if you match a fsl_of_msi_ids[]
> entry with the DT.
> 
> So the current check for a NULL match is not something that can happen
> short of some other bug somewhere.
> 

Ok.

Then it would be good to have a sentence explaining that in the commit 
message.

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ