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: Thu, 21 Dec 2023 18:55:17 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Hugo Villeneuve <hugo@...ovil.com>
Cc: gregkh@...uxfoundation.org, jirislaby@...nel.org, jringle@...dpoint.com,
	kubakici@...pl, phil@...pberrypi.org, linux-kernel@...r.kernel.org,
	linux-serial@...r.kernel.org,
	Hugo Villeneuve <hvilleneuve@...onoff.com>
Subject: Re: [PATCH 09/18] serial: sc16is7xx: add macro for max number of
 UART ports

On Thu, Dec 21, 2023 at 11:41:03AM -0500, Hugo Villeneuve wrote:
> On Wed, 20 Dec 2023 17:50:34 +0200
> Andy Shevchenko <andriy.shevchenko@...el.com> wrote:
> > On Tue, Dec 19, 2023 at 12:18:53PM -0500, Hugo Villeneuve wrote:

...

> > > -	if (count < 0 || count > ARRAY_SIZE(irda_port))
> > > +	if (count < 0 || count > SC16IS7XX_MAX_PORTS)
> > 
> > ARRAY_SIZE() is more robust than this. What if you change to support different
> > devices where this won't be as defined?
> 
> not sure that I understand your point, because SC16IS7XX_MAX_PORTS is
> the maximum for all devices supported by this driver. The irda_port
> array always has a fixed number of elements set to SC16IS7XX_MAX_PORTS,
> even if the device that we are probing has only one port for example.

For current models of the device, yes. Who knows the future?
Also, ARRAY_SIZE() make it less points to update if ever needed.

> But I can change it back to ARRAY_SIZE(irda_port) if you want.

Please change it back.

> > >  		return;

...

> > > +	WARN_ON(devtype->nr_uart > SC16IS7XX_MAX_PORTS);
> > 
> > Not sure about this, perhaps it's fine.
> 
> This check is only there if we add support for a new device and we
> incorrectly set nr_uart to an incorrect value, which will cause other
> problems anyway, of course :)
> 
> This could be removed.

Let's remove. We can add it back in case something like this (quite unlikely)
happens.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ