Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/common/memory_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ class PageAllocator {
template <typename T>
static T AlignUp(T offset, size_t alignment) {
assert(alignment > 0 && ((alignment - 1) & alignment) == 0);
return (offset + (alignment - 1)) & ~(alignment - 1);
const T mask = static_cast<T>(alignment - 1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't change the semantics of the code at all. It just factors out a common subexpression without changing its type.

If there were really an issue due to passing in an alignment larger than 2^32, you'd have to change the type of the function argument. But a 32-bit process can't allocate more than 2^32 so that doesn't makes sense and can't happen.

return (offset + mask) & ~mask;
}

// Allocates an array with requested amount of `bytes` and at a location with
Expand Down
2 changes: 1 addition & 1 deletion src/processor/minidump_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ static const MDRawSystemInfo* GetSystemInfo(Minidump* dump,
}

static uint64_t GetAddressForArchitecture(const MDCPUArchitecture architecture,
size_t raw_address)
uint64_t raw_address)
{
switch (architecture) {
case MD_CPU_ARCHITECTURE_X86:
Expand Down