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]
Message-ID: <cd5e677afaefb5ffa48913f4b6aa1efb@dev.tdt.de>
Date: Mon, 29 Sep 2025 08:33:10 +0200
From: Florian Eckert <fe@....tdt.de>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: gregkh@...uxfoundation.org, kumaravel.thiagarajan@...rochip.com,
	andriy.shevchenko@...ux.intel.com, pnewman@...necttech.com,
	angelogioacchino.delregno@...labora.com, peterz@...radead.org,
	yujiaoliang@...o.com, arnd@...nel.org, cang1@...e.co.uk,
	macro@...am.me.uk, schnelle@...ux.ibm.com,
	Eckert.Florian@...glemail.com, linux-kernel@...r.kernel.org,
	linux-serial@...r.kernel.org
Subject: Re: [PATCH] serial: 8250_pcilib: Replace deprecated PCI functions

On 2025-09-29 08:00, Jiri Slaby wrote:
> On 26. 09. 25, 14:31, Florian Eckert wrote:
>>>> Signed-off-by: Florian Eckert <fe@....tdt.de>
>>> ...
>>>> --- a/drivers/tty/serial/8250/8250_pci.c
>>>> +++ b/drivers/tty/serial/8250/8250_pci.c
>>>> @@ -165,7 +165,15 @@ static int
>>>>   setup_port(struct serial_private *priv, struct uart_8250_port 
>>>> *port,
>>>>          u8 bar, unsigned int offset, int regshift)
>>>>   {
>>>> -    return serial8250_pci_setup_port(priv->dev, port, bar, offset, 
>>>> regshift);
>>>> +    void __iomem *iomem = NULL;
>>>> +
>>>> +    if (pci_resource_flags(priv->dev, bar) & IORESOURCE_MEM) {
>>>> +        iomem = pcim_iomap(priv->dev, bar, 0);
>>>> +        if (IS_ERR(iomem))
>>>> +            return -ENOMEM;
>>> 
>>> Why not to propagate the error?
>> 
>> Most other calls in the kernel of this function return
>> -ENOMEM on error. Therefore, I thought that this is the
>> correct return value. I can fix that in v2 if you like.
>> Let me know what you prefer.
> 
> Ugh, pcim_iomap() returns NULL on error, so the IS_ERR() check is all
> wrong. What other places in the kernel use IS_ERR()? They need fixing.

You're right. The function returns a pointer here and my check IS_ERR()
is wrong. I mixed it up with the 'pcim_iomap_region()' function.
Because I wanted to use this function before. As far as I can see, the 
return
value of 'pcim_iomap()' is checked correctly in the linux sources.

Sorry for the noise.

I will adjust this and send a V2 patch.

--
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ