[Qemu-devel] [PATCH] vmstate: check subsection_found is enough

Wei Yang posted 1 patch 5 years ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190402025728.5636-1-richardw.yang@linux.intel.com
Maintainers: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Juan Quintela <quintela@redhat.com>
There is a newer version of this series
migration/vmstate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] vmstate: check subsection_found is enough
Posted by Wei Yang 5 years ago
subsection_found is true implies vmdesc is not NULL.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/vmstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/vmstate.c b/migration/vmstate.c
index e2bbb7b5f7..8327179eea 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
         sub++;
     }
 
-    if (vmdesc && subsection_found) {
+    if (subsection_found) {
         json_end_array(vmdesc);
     }
 
-- 
2.19.1


Re: [Qemu-devel] [PATCH] vmstate: check subsection_found is enough
Posted by Dr. David Alan Gilbert 5 years ago
* Wei Yang (richardw.yang@linux.intel.com) wrote:
> subsection_found is true implies vmdesc is not NULL.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  migration/vmstate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration/vmstate.c b/migration/vmstate.c
> index e2bbb7b5f7..8327179eea 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
>          sub++;
>      }
>  
> -    if (vmdesc && subsection_found) {
> +    if (subsection_found) {

That's true, however it's not obvious from the names; I think
we should probably rename 'subsection_found' to something like
'vmdesc_has_subsections'  then it's more obvious that subsection_found
is more specialised in this routine.

Dave


>          json_end_array(vmdesc);
>      }
>  
> -- 
> 2.19.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

Re: [Qemu-devel] [PATCH] vmstate: check subsection_found is enough
Posted by Wei Yang 5 years ago
On Tue, Apr 02, 2019 at 07:44:23PM +0100, Dr. David Alan Gilbert wrote:
>* Wei Yang (richardw.yang@linux.intel.com) wrote:
>> subsection_found is true implies vmdesc is not NULL.
>> 
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> ---
>>  migration/vmstate.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/migration/vmstate.c b/migration/vmstate.c
>> index e2bbb7b5f7..8327179eea 100644
>> --- a/migration/vmstate.c
>> +++ b/migration/vmstate.c
>> @@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
>>          sub++;
>>      }
>>  
>> -    if (vmdesc && subsection_found) {
>> +    if (subsection_found) {
>
>That's true, however it's not obvious from the names; I think
>we should probably rename 'subsection_found' to something like
>'vmdesc_has_subsections'  then it's more obvious that subsection_found
>is more specialised in this routine.

Reasonable, let me change it :-)

>
>Dave
>
>
>>          json_end_array(vmdesc);
>>      }
>>  
>> -- 
>> 2.19.1
>> 
>--
>Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

-- 
Wei Yang
Help you, Help me