[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringo
From: |
Daniel P . Berrangé |
Subject: |
Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] |
Date: |
Thu, 22 Apr 2021 12:48:35 +0100 |
User-agent: |
Mutt/2.0.5 (2021-01-21) |
On Thu, Apr 22, 2021 at 01:24:30PM +0200, Philippe Mathieu-Daudé wrote:
> This silents the warning however:
>
> -- >8 --
> diff --git a/pc-bios/s390-ccw/libc.h b/pc-bios/s390-ccw/libc.h
> index bcdc45732d..2dea399904 100644
> --- a/pc-bios/s390-ccw/libc.h
> +++ b/pc-bios/s390-ccw/libc.h
> @@ -19,6 +19,8 @@ typedef unsigned short uint16_t;
> typedef unsigned int uint32_t;
> typedef unsigned long long uint64_t;
>
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wstringop-overflow"
> static inline void *memset(void *s, int c, size_t n)
> {
> size_t i;
> @@ -30,6 +32,7 @@ static inline void *memset(void *s, int c, size_t n)
>
> return s;
> }
> +#pragma GCC diagnostic pop
I wonder if it works if you put the pragma around the specific
caller, as that would make the scope more limited so we can still
see valid bugs elsewhere
>
> static inline void *memcpy(void *s1, const void *s2, size_t n)
> {
> ---
>
> Oddly this code doesn't emit any warning:
Let me correct that for you
s/doesn't emit any warning/doesn't emit any warning *yet*/
compilers get more strict all the time. The memcmp is just
a memory read, however, while memset is a write, so less
severe
> if (!memcmp((char *)S390EP, "S390EP", 6)) {
> ...
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=], (continued)
- Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=], Philippe Mathieu-Daudé, 2021/04/22
- Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=], Stefano Garzarella, 2021/04/23
- Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=], Christian Borntraeger, 2021/04/23
- Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0), Thomas Huth, 2021/04/23
- Re: Compiling the s390-ccw bios with clang, Christian Borntraeger, 2021/04/23
- Re: Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0), Cornelia Huck, 2021/04/23
- Re: Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0), Thomas Huth, 2021/04/23
- Re: Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0), Daniel P . Berrangé, 2021/04/23
- Re: Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0), Thomas Huth, 2021/04/23
- Re: Compiling the s390-ccw bios with clang (was: Re: s390-ccw: warning: writing 1 byte into a region of size 0), Daniel P . Berrangé, 2021/04/23
- Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=],
Daniel P . Berrangé <=
- Re: s390-ccw: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=], Philippe Mathieu-Daudé, 2021/04/22