Re: [PATCH 1/2] PCI: Avoid access memory outside the resource window

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

 



On Tue, Jun 05, 2018 at 09:46:45AM +0800, Rex Zhu wrote:
> change ">" to ">=" to avoid access beyond the actual
> length of io memory.
> 
> Signed-off-by: Rex Zhu <Rex.Zhu@xxxxxxx>

Both applied with Alex's reviewed-by to pci/resource for v4.19, thanks!

I also added a patch to make pci_get_rom_size() static, since it's only
used by pci_map_rom().

> ---
>  drivers/pci/rom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
> index 374a334..a5c6016 100644
> --- a/drivers/pci/rom.c
> +++ b/drivers/pci/rom.c
> @@ -108,7 +108,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
>  		length = readw(pds + 16);
>  		image += length * 512;
>  		/* Avoid iterating through memory outside the resource window */
> -		if (image > rom + size)
> +		if (image >= rom + size)
>  			break;
>  	} while (length && !last_image);
>  
> -- 
> 1.9.1
> 



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux