Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca365b9d authored by Oana Medvesan's avatar Oana Medvesan Committed by Keith Fallows
Browse files

t-base-301B: fix bug TD-471 on generating a better buffer handle for mmap error on Android L



Change-Id: I4c9710d88054df7367e2fa2f76b33d0b25a4b5ed
Signed-off-by: default avatarOana Medvesan <medvesan.oana@gmail.com>
Git-commit: 2a58937b884bb42e681ea2bc5db149f71b3457ae
Git-repo: https://code.google.com/p/tee-mobicore-driver.kernel/


Signed-off-by: default avatarKeith Fallows <keithf@codeaurora.org>
Acked-by: default avatarTony Hamilton <tonyh@qti.qualcomm.com>
parent b876d15c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -114,11 +114,12 @@ static uint32_t get_new_buffer_handle(void)
	/* assumption ctx.bufs_lock mutex is locked */
retry:
	handle = atomic_inc_return(&ctx.buffer_counter);
	/* if upper 12 bits are set we must reset to 0, we can only
	 * handler 20 bits of unique ID for the buffer because the need
	 * to support both 32 and 64 bit clients with the 64 bit kernel
	/* The handle must leave 12 bits (PAGE_SHIFT) for the 12 LSBs to be
	 * zero, as mmap requires the offset to be page-aligned, plus 1 bit for
	 * the MSB to be 0 too, so mmap does not see the offset as negative
	 * and fail.
	 */
	if ((handle << PAGE_SHIFT) == 0)  {
	if ((handle << (PAGE_SHIFT+1)) == 0)  {
		atomic_set(&ctx.buffer_counter, 1);
		handle = 1;
	}