diff options
Diffstat (limited to '')
-rw-r--r-- | otautil/SysUtil.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/otautil/SysUtil.cpp b/otautil/SysUtil.cpp index 2936c5ca4..4cdd60d9f 100644 --- a/otautil/SysUtil.cpp +++ b/otautil/SysUtil.cpp @@ -118,10 +118,10 @@ static int sysMapBlockFile(FILE* mapf, MemMapping* pMap) break; } size_t length = (end - start) * blksize; - if (end <= start || (end - start) > SIZE_MAX / blksize || length > remaining_size) { - LOG(ERROR) << "unexpected range in block map: " << start << " " << end; - success = false; - break; + if (end <= start || ((end - start) > SIZE_MAX / blksize) || length > remaining_size) { + LOG(ERROR) << "unexpected range in block map: " << start << " " << end; + success = false; + break; } void* addr = mmap64(next, length, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, ((off64_t)start)*blksize); @@ -137,8 +137,8 @@ static int sysMapBlockFile(FILE* mapf, MemMapping* pMap) remaining_size -= length; } if (success && remaining_size != 0) { - LOG(ERROR) << "ranges in block map are invalid: remaining_size = " << remaining_size; - success = false; + LOG(ERROR) << "ranges in block map are invalid: remaining_size = " << remaining_size; + success = false; } if (!success) { close(fd); |