]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - arch/powerpc/platforms/powernv/pci-ioda.c
powerpc/powernv: Fix insufficient memory allocation
[mirror_ubuntu-zesty-kernel.git] / arch / powerpc / platforms / powernv / pci-ioda.c
index 4cfe704106da4d50bf5202f55d6727b36b5925a1..7e1e4f105b9459f5f009eafbb9d8a7ac24b5dbf0 100644 (file)
@@ -3504,7 +3504,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
                                PNV_IODA1_DMA32_SEGSIZE;
 
        /* Allocate aux data & arrays. We don't have IO ports on PHB3 */
-       size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long));
+       size = _ALIGN_UP(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8,
+                       sizeof(unsigned long));
        m64map_off = size;
        size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]);
        m32map_off = size;