Re: Patch review request

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

 



On Tue, Dec 30, 2008 at 03:35:27PM +1100, Timothy S. Nelson wrote:
> 	Hi all.  Jesse Barnes requested that I post some patches from bug 
> 12168 here for review.

> diff -urN linux-2.6.27/drivers/pci/rom.c linux-2.6.27.rom/drivers/pci/rom.c
> --- linux-2.6.27/drivers/pci/rom.c	2008-10-10 09:13:53.000000000 +1100
> +++ linux-2.6.27.rom/drivers/pci/rom.c	2008-12-29 14:48:58.000000000 +1100
> @@ -73,19 +73,19 @@
>  		void __iomem *pds;
>  		/* Standard PCI ROMs start out with these bytes 55 AA */
>  		if (readb(image) != 0x55)
> -			break;
> +			return -EIO;

pci_get_rom_size() returns a size_t, not an ssize_t, so returning an
error number is a bad idea.  A negative number is going to be treated as
a very large positive number, so there's opportunity for lots of mayhem.
0 already indicates an error, so I don't quite see what problem you're
trying to fix here.

> +++ linux-2.6.28-rc7/drivers/pci/pci-sysfs.c	2008-12-06 19:58:25.000000000 -0500
> @@ -777,8 +777,8 @@
>  		return -EINVAL;
>  	
>  	rom = pci_map_rom(pdev, &size);	/* size starts out as PCI window size */
> -	if (!rom)
> -		return 0;
> +	if (!rom || !size)
> +		return -EIO;
>  		
>  	if (off >= size)
>  		count = 0;

This patch, otoh, makes a metric tonne of sense.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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