Skip to contentSkip to conversation

clock-vmstate: Add missing END_OF_LIST

PATCH In review Dr. David Alan Gilbert (git) 5 participants 8 messages Jan 11, 2022 – Mar 2, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clock-vmstate: Add missing END_OF_LIST

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +1 -0
index 9d9174ffbd..7eccb6d4ea 100644
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +0 -0
index 9d9174ffbd..7eccb6d4ea 100644

hw/core/clock-vmstate.c const VMStateDescription vmstate_muldiv = { · line 49

Quoted 6 lines
hw/core/clock-vmstate.c +1 -0
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };

Oops :-(

We could maybe make this kind of bug more likely to be detected by instead of having the terminator be an "all zeros" VMStateField, having it check both for name == NULL and for a magic number in the VMStateFlags field. That way (assuming something in "make check" causes us to do a scan through every registered vmstate struct) forgetting the terminator will be likely to cause us to crash or hang rather than finding some 0 data and thinking that's the terminator.

thanks
-- PMM

#2 lore raw
Quoted 29 lines · * Peter Maydell ([email protected]) wrote:
Quoted 16 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +0 -0
index 9d9174ffbd..7eccb6d4ea 100644

hw/core/clock-vmstate.c const VMStateDescription vmstate_muldiv = { · line 49

Quoted 6 lines
hw/core/clock-vmstate.c +1 -0
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };

Oops :-(

Quoted 8 lines

We could maybe make this kind of bug more likely to be detected by instead of having the terminator be an "all zeros" VMStateField, having it check both for name == NULL and for a magic number in the VMStateFlags field. That way (assuming something in "make check" causes us to do a scan through every registered vmstate struct) forgetting the terminator will be likely to cause us to crash or hang rather than finding some 0 data and thinking that's the terminator.

Yeh, let me see what I can come up with for that.

Dave

Quoted 3 lines

thanks
-- PMM

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#3 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 16 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +0 -0
index 9d9174ffbd..7eccb6d4ea 100644

hw/core/clock-vmstate.c const VMStateDescription vmstate_muldiv = { · line 49

Quoted 6 lines
hw/core/clock-vmstate.c +1 -0
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };

Cc: [email protected]
seems appropriate here ?

thanks
-- PMM

Reviewed-by on v1 1/1
#4 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 5 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")

Doh I missed this too :(

Quoted 17 lines
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +1 -0
index 9d9174ffbd..7eccb6d4ea 100644
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };
 
Reviewed-by on v1 1/1
#6 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 6 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")
Quoted 19 lines
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +1 -0
index 9d9174ffbd..7eccb6d4ea 100644
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };
 
Signature · 1 line
2.34.1
#7 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 3 lines · * Dr. David Alan Gilbert (git) ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv

Queued

Quoted 23 lines
Fixes 99abcbc7600 ("clock: Provide builtin multiplier/divider")
---
 hw/core/clock-vmstate.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/clock-vmstate.c +1 -0
index 9d9174ffbd..7eccb6d4ea 100644
@@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(multiplier, Clock),
         VMSTATE_UINT32(divider, Clock),
+        VMSTATE_END_OF_LIST()
     },
 };
 
Signature · 1 line
2.34.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK