[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] migration: check length directly to make sure t
From: |
Wei Yang |
Subject: |
Re: [Qemu-devel] [PATCH] migration: check length directly to make sure the range is aligned |
Date: |
Mon, 19 Aug 2019 10:26:39 +0800 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Fri, Jul 19, 2019 at 06:54:00PM +0100, Dr. David Alan Gilbert wrote:
>* Wei Yang (address@hidden) wrote:
>> Since the start addr is already checked, to make sure the range is
>> aligned, checking the length is enough.
>>
>> Signed-off-by: Wei Yang <address@hidden>
>> ---
>> exec.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/exec.c b/exec.c
>> index 50ea9c5aaa..8fa980baae 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -4067,10 +4067,9 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t
>> start, size_t length)
>>
>> if ((start + length) <= rb->used_length) {
>> bool need_madvise, need_fallocate;
>> - uint8_t *host_endaddr = host_startaddr + length;
>> - if ((uintptr_t)host_endaddr & (rb->page_size - 1)) {
>> - error_report("ram_block_discard_range: Unaligned end address:
>> %p",
>> - host_endaddr);
>> + if (length & (rb->page_size - 1)) {
>> + error_report("ram_block_discard_range: Unaligned length: %lx",
>> + length);
>
>Yes, I *think* this is safe, we'll need to watch out for any warnings;
>David Gibson's balloon fix from February means that the balloon code
>should now warn in it's case.
>
>rth: Want to pick this up?
>
>Reviewed-by: Dr. David Alan Gilbert <address@hidden>
>
Hi, David
Do you like this one?
>> goto err;
>> }
>>
>> --
>> 2.17.1
>>
>--
>Dr. David Alan Gilbert / address@hidden / Manchester, UK
--
Wei Yang
Help you, Help me
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH] migration: check length directly to make sure the range is aligned,
Wei Yang <=