Patch review request

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

 



Hi all. Jesse Barnes requested that I post some patches from bug 12168 here for review.

	The Bug: http://bugzilla.kernel.org/show_bug.cgi?id=12168

Both these patches change the PCI ROM reading code to return errors instead of ignoring them.

	The rom_size patch is by me, the other by Alex Villacis-Lasso.

	Thanks all...


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayland@xxxxxxxxxxxxx    | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----
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;
 		if (readb(image + 1) != 0xAA)
-			break;
+			return -EIO;
 		/* get the PCI data structure and check its signature */
 		pds = image + readw(image + 24);
 		if (readb(pds) != 'P')
-			break;
+			return -EIO;
 		if (readb(pds + 1) != 'C')
-			break;
+			return -EIO;
 		if (readb(pds + 2) != 'I')
-			break;
+			return -EIO;
 		if (readb(pds + 3) != 'R')
-			break;
+			return -EIO;
 		last_image = readb(pds + 21) & 0x80;
 		/* this length is reliable */
 		image += readw(pds + 16) * 512;
--- linux-2.6-git/drivers/pci/pci-sysfs.c	2008-11-10 10:33:46.000000000 -0500
+++ 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;

[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