Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-21 Thread Juan Quintela
Paolo Bonzini wrote: > On 21/08/2018 08:03, Thomas Huth wrote: gcc is not necessarily wrong, as it CAN catch real erroneous uses of strncpy(). It's just that 99% of the time, strncpy() is the WRONG function to use, and so the remaining few cases where it actually does what

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-21 Thread Paolo Bonzini
On 21/08/2018 08:03, Thomas Huth wrote: >>> gcc is not necessarily wrong, as it CAN catch real erroneous uses of >>> strncpy(). It's just that 99% of the time, strncpy() is the WRONG >>> function to use, and so the remaining few cases where it actually does >>> what you want are so rare that yo

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread Thomas Huth
On 2018-08-20 21:59, David Hildenbrand wrote: > On 20.08.2018 21:48, Eric Blake wrote: >> On 08/20/2018 12:16 PM, Thomas Huth wrote: >> Maybe really set it to zero (memset) before using the g_strlcpy? I am not a fan of disabling warnings, but if you think this is easier/cleaner,

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread David Hildenbrand
On 20.08.2018 21:48, Eric Blake wrote: > On 08/20/2018 12:16 PM, Thomas Huth wrote: > >>> >>> Maybe really set it to zero (memset) before using the g_strlcpy? I am >>> not a fan of disabling warnings, but if you think this is >>> easier/cleaner, let's go for that. > > I'm not a fan of strlcpy in

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread Eric Blake
On 08/20/2018 12:16 PM, Thomas Huth wrote: Maybe really set it to zero (memset) before using the g_strlcpy? I am not a fan of disabling warnings, but if you think this is easier/cleaner, let's go for that. I'm not a fan of strlcpy in general (by the time you've properly set it up to detect/r

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread Thomas Huth
On 2018-08-20 15:28, David Hildenbrand wrote: > On 20.08.2018 15:23, Paolo Bonzini wrote: >> On 18/08/2018 04:56, Philippe Mathieu-Daudé wrote: >>> Fedora 29 comes with GCC 8.1 which added the 'stringop-truncation' checks. >>> >>> Replace the strncpy() calls by g_strlcpy() to avoid the following wa

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread Paolo Bonzini
On 18/08/2018 04:56, Philippe Mathieu-Daudé wrote: > Fedora 29 comes with GCC 8.1 which added the 'stringop-truncation' checks. > > Replace the strncpy() calls by g_strlcpy() to avoid the following warning: > > migration/global_state.c: In function 'global_state_store_running': > migration/gl

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread David Hildenbrand
On 20.08.2018 15:23, Paolo Bonzini wrote: > On 18/08/2018 04:56, Philippe Mathieu-Daudé wrote: >> Fedora 29 comes with GCC 8.1 which added the 'stringop-truncation' checks. >> >> Replace the strncpy() calls by g_strlcpy() to avoid the following warning: >> >> migration/global_state.c: In function

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread David Hildenbrand
On 18.08.2018 04:56, Philippe Mathieu-Daudé wrote: > Fedora 29 comes with GCC 8.1 which added the 'stringop-truncation' checks. > > Replace the strncpy() calls by g_strlcpy() to avoid the following warning: > > migration/global_state.c: In function 'global_state_store_running': > migration/gl

Re: [Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-20 Thread Juan Quintela
Philippe Mathieu-Daudé wrote: > Fedora 29 comes with GCC 8.1 which added the 'stringop-truncation' checks. > > Replace the strncpy() calls by g_strlcpy() to avoid the following warning: > > migration/global_state.c: In function 'global_state_store_running': > migration/global_state.c:45:5: err

[Qemu-devel] [PATCH] migration: Replace strncpy() by g_strlcpy()

2018-08-17 Thread Philippe Mathieu-Daudé
Fedora 29 comes with GCC 8.1 which added the 'stringop-truncation' checks. Replace the strncpy() calls by g_strlcpy() to avoid the following warning: migration/global_state.c: In function 'global_state_store_running': migration/global_state.c:45:5: error: 'strncpy' specified bound 100 equals