summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorSrinivasarao P <spathi@codeaurora.org>2019-08-07 11:09:26 +0530
committerSrinivasarao P <spathi@codeaurora.org>2019-08-07 11:10:24 +0530
commit7b0c4ab61ef1dc4eaa00ee0d9b4c50ca0193ad75 (patch)
tree397dd18af48f396145bf68538cc1e333748f87d6 /mm
parent27f8e158ab4abb61edd03ce70561bc5c67c3e623 (diff)
parent886d08593458ade141937c7839fa206ab32f4c5c (diff)
Merge android-4.4.188 (886d085) into msm-4.4
* refs/heads/tmp-886d085 Linux 4.4.188 xen/swiotlb: fix condition for calling xen_destroy_contiguous_region() s390/dasd: fix endless loop after read unit address configuration selinux: fix memory leak in policydb_init() x86/kvm: Don't call kvm_spurious_fault() from .fixup ipc/mqueue.c: only perform resource calculation if user valid uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers coda: fix build using bare-metal toolchain coda: add error handling for fget mm/cma.c: fail if fixed declaration can't be honored x86: math-emu: Hide clang warnings for 16-bit overflow x86/apic: Silence -Wtype-limits compiler warnings be2net: Signal that the device cannot transmit during reconfiguration ACPI: fix false-positive -Wuninitialized warning scsi: zfcp: fix GCC compiler warning emitted with -Wmaybe-uninitialized ceph: fix improper use of smp_mb__before_atomic() btrfs: fix minimum number of chunk errors for DUP fs/adfs: super: fix use-after-free bug dmaengine: rcar-dmac: Reject zero-length slave DMA requests MIPS: lantiq: Fix bitfield masking kernel/module.c: Only return -EEXIST for modules that have finished loading ARM: dts: rockchip: Mark that the rk3288 timer might stop in suspend ARM: riscpc: fix DMA Change-Id: I5117beda77a1297c46e7b105bd70d1d726dd6d2b Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/cma.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mm/cma.c b/mm/cma.c
index 664364b62782..34e099574063 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -273,6 +273,12 @@ int __init cma_declare_contiguous(phys_addr_t base,
*/
alignment = max(alignment, (phys_addr_t)PAGE_SIZE <<
max_t(unsigned long, MAX_ORDER - 1, pageblock_order));
+ if (fixed && base & (alignment - 1)) {
+ ret = -EINVAL;
+ pr_err("Region at %pa must be aligned to %pa bytes\n",
+ &base, &alignment);
+ goto err;
+ }
base = ALIGN(base, alignment);
size = ALIGN(size, alignment);
limit &= ~(alignment - 1);
@@ -303,6 +309,13 @@ int __init cma_declare_contiguous(phys_addr_t base,
if (limit == 0 || limit > memblock_end)
limit = memblock_end;
+ if (base + size > limit) {
+ ret = -EINVAL;
+ pr_err("Size (%pa) of region at %pa exceeds limit (%pa)\n",
+ &size, &base, &limit);
+ goto err;
+ }
+
/* Reserve memory */
if (fixed) {
if (memblock_is_region_reserved(base, size) ||