hvmloader: fix scratch_alloc to avoid overlaps

scratch_alloc() set scratch_start to the last byte of the current
allocation.  The value of scratch_start is then reused as is (if it is
already aligned) in the next allocation.  This result in a potential reuse
of the last byte of the previous allocation.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 4ab3ac074c
master date: 2016-02-10 14:46:45 +0100
This commit is contained in:
Anthony PERARD authored and Jan Beulich committed 2016-02-17 16:41:01 +01:00
1 parent ad1313a3b0
commit 3d8689b6b1
1 file changed
+1 -1
+1 -1
View File
@@ -478,7 +478,7 @@ void *scratch_alloc(uint32_t size, uint32_t align)
if ( align < 16 )
align = 16;
s = (scratch_start + align - 1) & ~(align - 1);
s = (scratch_start + align) & ~(align - 1);
e = s + size - 1;
BUG_ON(e < s);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.