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: <136e3881-bff4-d1f0-e146-b5c0a58f2e80@kernel.org>
Date:   Wed, 14 Jul 2021 08:57:06 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v1 1/4] serial: 8250_pci: Refactor the loop in
 pci_ite887x_init()

On 13. 07. 21, 12:40, Andy Shevchenko wrote:
> The loop can be refactored by using ARRAY_SIZE() instead of NULL terminator.
> This reduces code base and makes it easier to read and understand.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>   drivers/tty/serial/8250/8250_pci.c | 16 +++++-----------
>   1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index 02985cf90ef2..b9138bd08b7f 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -897,37 +897,31 @@ static int pci_netmos_init(struct pci_dev *dev)
>   /* enable IO_Space bit */
>   #define ITE_887x_POSIO_ENABLE		(1 << 31)
>   
> +/* inta_addr are the configuration addresses of the ITE */
> +static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0, 0x200, 0x280, };
>   static int pci_ite887x_init(struct pci_dev *dev)
>   {
> -	/* inta_addr are the configuration addresses of the ITE */
> -	static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
> -							0x200, 0x280, 0 };
>   	int ret, i, type;
>   	struct resource *iobase = NULL;
>   	u32 miscr, uartbar, ioport;
>   
>   	/* search for the base-ioport */
> -	i = 0;
> -	while (inta_addr[i] && iobase == NULL) {
> -		iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
> -								"ite887x");
> +	for (i = 0; i < ARRAY_SIZE(inta_addr); i++) {
> +		iobase = request_region(inta_addr[i], ITE_887x_IOSIZE, "ite887x");

Irrelevant whitespace change.

>   		if (iobase != NULL) {
>   			/* write POSIO0R - speed | size | ioport */
>   			pci_write_config_dword(dev, ITE_887x_POSIO0,
>   				ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
>   				ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
>   			/* write INTCBAR - ioport */
> -			pci_write_config_dword(dev, ITE_887x_INTCBAR,
> -								inta_addr[i]);
> +			pci_write_config_dword(dev, ITE_887x_INTCBAR, inta_addr[i]);

detto

>   			ret = inb(inta_addr[i]);
>   			if (ret != 0xff) {
>   				/* ioport connected */
>   				break;
>   			}
>   			release_region(iobase->start, ITE_887x_IOSIZE);
> -			iobase = NULL;
>   		}
> -		i++;
>   	}
>   
>   	if (!inta_addr[i]) {

OOB access?

regards,
-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ