s390x: Use strpadcpy for copying vm name
commite6a80232f4087e8c7ec253f573319f69165b859d
authorMiroslav Rezanina <mrezanin@redhat.com>
Thu, 14 Jan 2021 07:07:36 +0000 (14 08:07 +0100)
committerCornelia Huck <cohuck@redhat.com>
Thu, 21 Jan 2021 10:19:45 +0000 (21 11:19 +0100)
tree65c536405eaa17a2b8f85895e180426d2a573cbf
parentb2f96f9e4f5fbc8f2770a436191cb328da4d5350
s390x: Use strpadcpy for copying vm name

Using strncpy with length equal to the size of target array, GCC 11
reports following warning:

  warning: '__builtin_strncpy' specified bound 256 equals destination size [-Wstringop-truncation]

We can prevent this warning by using strpadcpy that copies string
up to specified length, zeroes target array after copied string
and does not raise warning when length is equal to target array
size (and ending '\0' is discarded).

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <6f86915755219cf6a671788075da4809b57f7d7b.1610607906.git.mrezanin@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
target/s390x/kvm.c
target/s390x/misc_helper.c