qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/2] s390x: Use strpadcpy for copying vm name


From: Cornelia Huck
Subject: Re: [PATCH v3 2/2] s390x: Use strpadcpy for copying vm name
Date: Thu, 14 Jan 2021 11:16:20 +0100

On Thu, 14 Jan 2021 08:07:36 +0100
Miroslav Rezanina <mrezanin@redhat.com> wrote:

> 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>
> ---
>  target/s390x/kvm.c         | 12 +++++-------
>  target/s390x/misc_helper.c |  7 +++++--
>  2 files changed, 10 insertions(+), 9 deletions(-)

Thanks, applied.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]