Re: [PATCH v1 1/4] serial: 8250_pci: Refactor the loop in pci_ite887x_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 14, 2021 at 08:57:06AM +0200, Jiri Slaby wrote:
> 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.

> > +		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++;

I believe with Joe's suggestion I can improve entire body of this branch
perhaps in a separate patch. Do you prefer one or two patches?

> >   	if (!inta_addr[i]) {
> 
> OOB access?

Yep, Dan reported the same. Missed during conversion. Will fix.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux