migration/global_state: replace strcpy("") with explicit NUL termination

Drop the unnecessary strcpy of an empty literal (and its spurious
(char *)& cast) in favor of a direct NUL store, which avoids the
libc call and hides no bugs behind a cast.

Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20260518110112.21395-3-guobin@linux.alibaba.com
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Bin Guo
2026-05-18 19:01:06 +08:00
committed by Peter Xu
parent ced4b9dfde
commit 22facc21ab

View File

@@ -148,7 +148,7 @@ static const VMStateDescription vmstate_globalstate = {
void register_global_state(void)
{
/* We would use it independently that we receive it */
strcpy((char *)&global_state.runstate, "");
global_state.runstate[0] = '\0';
global_state.received = false;
vmstate_register(NULL, 0, &vmstate_globalstate, &global_state);
}