ソースを参照

PCI: Fix calculation of bridge window's size and alignment

In case that one device's alignment is greater than its size, we may
get an incorrect size and alignment for its bus's memory window in
pbus_size_mem().  Fix this case.

Signed-off-by: Yongji Xie <elohimes@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Yongji Xie 8 年 前
コミット
c9c75143a5
1 ファイル変更2 行追加2 行削除
  1. 2 2
      drivers/pci/setup-bus.c

+ 2 - 2
drivers/pci/setup-bus.c

@@ -1066,10 +1066,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 				r->flags = 0;
 				r->flags = 0;
 				continue;
 				continue;
 			}
 			}
-			size += r_size;
+			size += max(r_size, align);
 			/* Exclude ranges with size > align from
 			/* Exclude ranges with size > align from
 			   calculation of the alignment. */
 			   calculation of the alignment. */
-			if (r_size == align)
+			if (r_size <= align)
 				aligns[order] += align;
 				aligns[order] += align;
 			if (order > max_order)
 			if (order > max_order)
 				max_order = order;
 				max_order = order;