diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-08-13 23:30:16 +0930 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2018-09-12 15:05:51 +0930 |
commit | 41c337e88b80938bcd36c1636bba246a2a61d6e1 (patch) | |
tree | 6cb381419ba6e1186b7d424875774a541cd0b5ee | |
parent | 26558dbb00e439fb6ea18566361c0671ea6133f5 (diff) | |
download | phosphor-mboxbridge-41c337e88b80938bcd36c1636bba246a2a61d6e1.tar.gz phosphor-mboxbridge-41c337e88b80938bcd36c1636bba246a2a61d6e1.zip |
windows: Always allocate a default-size dirty byte map
The current strategy caused memory corruption if windows are down-sized
from the default when a dirty-byte-map reallocation is triggered, as the
code would only allocate a dirty byte map of the current size. When the
window is resized up a gain the dirty byte map buffer is too small, and
we write off the end.
Instead, always allocate a byte map of the default window size which is
the largest the window can be.
Change-Id: I6f8dc414fb26c64e4947d5a19d6b795ead36e180
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r-- | windows.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -344,7 +344,7 @@ void windows_alloc_dirty_bytemap(struct mbox_context *context) /* There may already be one allocated */ free(cur->dirty_bmap); /* Allocate the new one */ - cur->dirty_bmap = calloc((cur->size >> + cur->dirty_bmap = calloc((context->windows.default_size >> context->block_size_shift), sizeof(*cur->dirty_bmap)); } |