From 24a1bc39bb7c4af1c5565816c66338ae231cf41c Mon Sep 17 00:00:00 2001 From: zhangkuili Date: Tue, 29 May 2018 10:23:29 +0800 Subject: [Stability][hwui] check mmap return value If mmap failed, it return -1 (MAP_FAILED) Bug:110507462 Test: manual Change-Id: I3d0bac2e7c8b0bdc9cfb4ebb7b766d858876679d Signed-off-by: zhangkuili --- libs/hwui/service/GraphicsStatsService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/hwui/service/GraphicsStatsService.cpp b/libs/hwui/service/GraphicsStatsService.cpp index f7a90b0a65ec..32b5132a6fa3 100644 --- a/libs/hwui/service/GraphicsStatsService.cpp +++ b/libs/hwui/service/GraphicsStatsService.cpp @@ -134,7 +134,7 @@ bool GraphicsStatsService::parseFromFile(const std::string& path, service::Graph return false; } void* addr = mmap(nullptr, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (!addr) { + if (addr == MAP_FAILED) { int err = errno; // The file not existing is normal for addToDump(), so only log if // we get an unexpected error -- cgit v1.2.3-59-g8ed1b