diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2017-08-08 10:06:32 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-08-15 13:30:58 +0300 |
commit | 63b85621d9aa6bdc410f01b22f7821cea3d7bdc6 (patch) | |
tree | 05fbafb3604884b73e7b90caafa8954059c46b83 /arch/powerpc/kernel/l2cr_6xx.S | |
parent | 7efbae90892b7858f1d4873d34ffffbeb460ed8b (diff) | |
download | linux-63b85621d9aa6bdc410f01b22f7821cea3d7bdc6.tar.xz |
powerpc/iommu: Avoid undefined right shift in iommu_range_alloc()
In iommu_range_alloc() we generate a mask by right shifting ~0,
however if the specified alignment is 0 then we right shift by 64,
which is undefined. UBSAN tells us so:
UBSAN: Undefined behaviour in ../arch/powerpc/kernel/iommu.c:193:35
shift exponent 64 is too large for 64-bit type 'long unsigned int'
We can avoid it by instead generating the mask with:
align_mask = (1ull << align_order) - 1;
That will also generate an undefined shift if align_order is 64 or
greater, but that shouldn't be a problem for a while.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/l2cr_6xx.S')
0 files changed, 0 insertions, 0 deletions