[Libguestfs] [PATCH nbdkit] server/public.c: Uninline nbdkit_strdup_intern to avoid compiler warning.
Eric Blake
eblake at redhat.com
Thu Sep 3 13:54:08 UTC 2020
On 9/3/20 4:41 AM, Richard W.M. Jones wrote:
> Previously with GCC 10.2 this code produced:
>
> In function ‘nbdkit_strndup_intern’,
> inlined from ‘nbdkit_strdup_intern’ at public.c:839:10:
> public.c:827:10: error: ‘strndup’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
> 827 | copy = strndup (str, n);
> | ^~~~~~~~~~~~~~~~
> ---
> server/public.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
I find the gcc warning annoying, but this workaround is fine (and
potentially even a bit more efficient, because it uses fewer function
calls).
ACK, regardless of whether gcc also agrees with your bug report.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list