]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/kvm/cma: Fix panic introduces by signed shift operation
authorLaurent Dufour <ldufour@linux.vnet.ibm.com>
Tue, 2 Sep 2014 16:13:01 +0000 (18:13 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 3 Sep 2014 08:34:07 +0000 (10:34 +0200)
commit46cbd90fe1b6dec27eade173f44ff21d1eb47023
tree19b8bd2d73b03d5a24bc0d1eb0043c266d710b53
parent23a12db0c3b59599c375f67f067b528414dded72
powerpc/kvm/cma: Fix panic introduces by signed shift operation

076fd7f8342744201a8bccd677b9265246ecffd1 introduces a memset in
kvmppc_alloc_hpt since the general CMA doesn't clear the memory it
allocates.

However, the size argument passed to memset is computed from a signed value
and its signed bit is extended by the cast the compiler is doing. This lead
to extremely large size value when dealing with order value >= 31, and
almost all the memory following the allocated space is cleaned. As a
consequence, the system is panicing and may even fail spawning the kdump
kernel.

This fix makes use of an unsigned value for the memset's size argument to
avoid sign extension. Among this fix, another shift operation which may
lead to signed extended value too is also fixed.

Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Alexander Graf <agraf@suse.de>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/powerpc/kvm/book3s_64_mmu_hv.c