Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yongji Xie and committed by
Bjorn Helgaas
c9c75143 ea629d87

+2 -2
+2 -2
drivers/pci/setup-bus.c
··· 1066 1066 r->flags = 0; 1067 1067 continue; 1068 1068 } 1069 - size += r_size; 1069 + size += max(r_size, align); 1070 1070 /* Exclude ranges with size > align from 1071 1071 calculation of the alignment. */ 1072 - if (r_size == align) 1072 + if (r_size <= align) 1073 1073 aligns[order] += align; 1074 1074 if (order > max_order) 1075 1075 max_order = order;