aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Donnellan <ajd@linux.ibm.com>2019-09-26 14:55:46 +0200
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-12-05 14:21:46 +0530
commitf25d660bd5622c59a11adaa174a0d01c9b7263d8 (patch)
treeecb545735a588ea46bcaec7b2afef68037200b6b
parent85ffc8f21f3b608a3c20d2e9afc1d846694a2960 (diff)
downloadskiboot-f25d660bd5622c59a11adaa174a0d01c9b7263d8.zip
skiboot-f25d660bd5622c59a11adaa174a0d01c9b7263d8.tar.gz
skiboot-f25d660bd5622c59a11adaa174a0d01c9b7263d8.tar.bz2
npu2-opencapi: Fix integer promotion bug in LPC allocation
[ Upstream commit e85e2e2b8b0a4dd96e10343df19df1a161cd6aac ] If you try to allocate an amount of LPC memory that's not a power of 2, we round the value up to the nearest power of 2. By the magic of C, "1 << n" gets treated as an int, even if you're assigning it to a uint64_t. Change 1 to 1ULL to fix this. (C, it's great.) Reported-by: Alastair D'Silva <alistair@d-silva.org> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
-rw-r--r--hw/npu2-opencapi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index 9a391bb..a54ef63 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -2135,7 +2135,7 @@ static int64_t alloc_mem_bar(struct npu2_dev *dev, uint64_t size, uint64_t *bar)
}
if (!is_pow2(size)) {
- size = 1 << (ilog2(size) + 1);
+ size = 1ull << (ilog2(size) + 1);
}
set_mem_bar(dev, phys_map_base, size);