Why lock_kernel() in drivers/pci/proc.c (2.6.0-test9)??

From: Peter Chubb
Date: Tue Nov 18 2003 - 21:30:51 EST



Hi,
What is the BKL protecting in
drivers/pci/proc.c:proc_bus_pci_lseek() ?

It looks useless to me, as file->f_pos is changed outside the lock
anyway, and all the other variables inside the locked region are
effectively constants for the purpose of this code.

So unless something subtle's going on, I suggest this:



--- linux-2.6.0-test9/drivers/pci/proc.c 2003-11-19 13:28:10.000000000 +1100
+++ new/drivers/pci/proc.c 2003-11-19 13:28:00.000000000 +1100
@@ -25,7 +25,6 @@
{
loff_t new = -1;

- lock_kernel();
switch (whence) {
case 0:
new = off;
@@ -37,7 +36,7 @@
new = PCI_CFG_SPACE_SIZE + off;
break;
}
- unlock_kernel();
+
if (new < 0 || new > PCI_CFG_SPACE_SIZE)
return -EINVAL;
return (file->f_pos = new);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/