Avoid underflow on an unsigned int when computering bg overrun

A computation for when a block group overruns the end of an image
was consistently storing a negative number in an unsigned var,
and then checking for >0, which is always true for negative numbers.
So first check if the number will be positive before computing it.

Change-Id: Ic8cff8f9ab9f4ea8c5a4dc42143c2430fa87ba12
Merge "Avoid underflow on an unsigned int when computering bg overrun"
am 7f026d09: Merge "Avoid underflow on an unsigned int when computering bg overrun"

* commit '7f026d09fa05a3aa93cea6f6e25df1b5c0f800a0':
  Avoid underflow on an unsigned int when computering bg overrun
libpagemap: fix memory leak in pm_process_destroy()

procrank/librank not impacted because they end quickly. But other
programs that use libpagemap and last for long time can easily see this
memory leak.

Change-Id: I8c9e9444555bef9145c9d89850987a29f15a9b3b
Signed-off-by: Carton He <carton.he@marvell.com>
Merge "libpagemap: fix memory leak in pm_process_destroy()"
am 1b72e0d0: Merge "libpagemap: fix memory leak in pm_process_destroy()"

* commit '1b72e0d0fa93e828facb3f4f2e84facff87d81fb':
  libpagemap: fix memory leak in pm_process_destroy()
use BIONIC implementation of mmap64

Change-Id: Idb0c3d3bb98f22ea7d78043b786e931613377b02
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Merge "use BIONIC implementation of mmap64"
am 67a05c0d: Merge "use BIONIC implementation of mmap64"

* commit '67a05c0d165d779126a5fa8831cd95a0bf2fd1f2':
  use BIONIC implementation of mmap64
Remove fatblock and libublock.

The kernel support for these no longer exists.

Change-Id: I33a613e0185f03486a92b569c7d277e443fd1d48
Merge "Remove fatblock and libublock."
am 49e5bca2: Merge "Remove fatblock and libublock."

* commit '49e5bca23f9759b9d75366a1f611249d6398a5e7':
  Remove fatblock and libublock.
kexec.h is a uapi header.

Uapi is not a subdirectory of the old headers; it's the new alternative.
Look for it in the right place. (Required by a recent external/kernel-headers
fix.)

Change-Id: I3ae468d3eb79b355dc1bf4127536c6e0f397555a
Merge "kexec.h is a uapi header."
Remove dead test.

All of the functionality of these tests has moved in to bionic/tests.

Bug: 9797008
Change-Id: I45f395cafb8dc83fbfc8179b004da920e4a34c87
Merge "Remove dead test."
procrank: Use %zu for size_t and %d for pid_t

Change-Id: Ic339a05a3091ec6b33b68bc5e76082de3513e9c7
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
procmem: Use size_t instead of int to remove a potential bug.

In procmem.c, num_maps and num_pages are declared as
int. Pointers (int*) to these variables are being
passed to functions pm_process_maps and pm_map_pagemap
respectively, both of which expect size_t * argument.

This will lead to problems in 64-bit systems where
size_t and int_t have different size.

To avoid the issue, num_maps and num_pages are declared
as size_t. In addition, loop counters i and j are now
declared as size_t to avoid comparison of signed int with
unsigned int.

Change-Id: I3fc51f9386c9b2d289d34808e19e3811ca4a3dae
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Merge "procrank: Use %zu for size_t and %d for pid_t"
Merge "procmem: Use size_t instead of int to remove a potential bug."