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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dfb7552f-9163-4334-b137-1bf69fbdef5b@maciej.szmigiero.name>
Date: Fri, 20 Jun 2025 23:48:09 +0200
From: "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 gregkh@...uxfoundation.org, linux-serial@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 30/33] serial: 8250: invert
 serial8250_register_8250_port() CIR condition

On 18.06.2025 07:48, Andy Shevchenko wrote:
> On Wed, Jun 11, 2025 at 12:03:16PM +0200, Jiri Slaby (SUSE) wrote:
>> There is no point in a long 'if' in serial8250_register_8250_port() to
>> just return ENOSPC for PORT_8250_CIR ports. Invert the condition and
>> return immediately.
>>
>> 'gpios' variable was moved to its set location.
>>
>> And return ENODEV instead of ENOSPC. The latter is a leftover from the
>> previous find-uart 'if'. The former makes a lot more sense in this case.
> 
> ...
> 
>> +	if (uart->port.type == PORT_8250_CIR) {
>> +		ret = -ENODEV;
>> +		goto unlock;
>> +	}
> 
>> +	if (up->port.flags & UPF_FIXED_TYPE)
>> +		uart->port.type = up->port.type;
> 
>> +	if (uart->port.type != PORT_8250_CIR) {
> 
> I admit that there tons of mysterious ways of UART initialisation, but can you
> elaborate how this is not a always-true conditional?
> 

Careful here, someone had an idea in the past that this is indeed
a dead code/branch and ended causing a regression [1].

It would definitely make sense to add a comment describing the code
flow there though as it proven to bewilder people.

Thanks,
Maciej

[1]: https://lore.kernel.org/lkml/c599065a-60f5-070e-c1e3-12b3ab2cbf0a@suse.com/


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ