From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, "Janosch Frank" <frankja@linux.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"Nico Böhr" <nrb@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, David Hildenbrand <david@redhat.com>,
Jan Richter <jarichte@redhat.com>
Subject: [kvm-unit-tests PATCH] s390x/snippets/c/sie-dat: Fix compiler warning with GCC 11.2
Date: Fri, 16 Feb 2024 20:00:48 +0100 [thread overview]
Message-ID: <20240216190048.83801-1-thuth@redhat.com> (raw)
GCC 11.2.1 from RHEL 9.0 complains:
s390x/snippets/c/sie-dat.c: In function ‘main’:
s390x/snippets/c/sie-dat.c:51:22: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
51 | *invalid_ptr = 42;
| ~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors
Let's use the OPAQUE_PTR() macro here too, which we already used
in other spots to fix similar -Wstringop-overflow warnings.
Reported-by: Jan Richter <jarichte@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
s390x/snippets/c/sie-dat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/s390x/snippets/c/sie-dat.c b/s390x/snippets/c/sie-dat.c
index ecfcb60e..9d89801d 100644
--- a/s390x/snippets/c/sie-dat.c
+++ b/s390x/snippets/c/sie-dat.c
@@ -9,6 +9,7 @@
*/
#include <libcflat.h>
#include <asm-generic/page.h>
+#include <asm/mem.h>
#include "sie-dat.h"
static uint8_t test_pages[GUEST_TEST_PAGE_COUNT * PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
@@ -47,7 +48,7 @@ int main(void)
force_exit();
/* the first unmapped address */
- invalid_ptr = (uint8_t *)(GUEST_TOTAL_PAGE_COUNT * PAGE_SIZE);
+ invalid_ptr = OPAQUE_PTR(GUEST_TOTAL_PAGE_COUNT * PAGE_SIZE);
*invalid_ptr = 42;
/* indicate we've written the non-allowed page (should never get here) */
--
2.43.0
next reply other threads:[~2024-02-16 19:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 19:00 Thomas Huth [this message]
2024-02-16 19:08 ` [kvm-unit-tests PATCH] s390x/snippets/c/sie-dat: Fix compiler warning with GCC 11.2 Claudio Imbrenda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240216190048.83801-1-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=jarichte@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox