mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 1/2] KASan: test_kasan: silence warning with newer GCC
Date: Mon, 12 Dec 2022 17:39:06 +0100	[thread overview]
Message-ID: <20221212163907.2356192-1-a.fatoum@pengutronix.de> (raw)

Newer GCC will rightly complain about this being an out-of-bounds
access. This is intended as the kasan command is meant to cause
out-of-bounds accesses to test proper operation of KASan.

Thus silence the warning for this specific instance.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 lib/kasan/test_kasan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/kasan/test_kasan.c b/lib/kasan/test_kasan.c
index d0ea91547711..14511cdb80bd 100644
--- a/lib/kasan/test_kasan.c
+++ b/lib/kasan/test_kasan.c
@@ -290,6 +290,8 @@ static noinline void kasan_alloca_oob_left(void)
 	char alloca_array[i];
 	char *p = alloca_array - 1;
 
+	OPTIMIZER_HIDE_VAR(p);
+
 	pr_info("out-of-bounds to left on alloca\n");
 	*(volatile char *)p;
 }
-- 
2.30.2




             reply	other threads:[~2022-12-12 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 16:39 Ahmad Fatoum [this message]
2022-12-12 16:39 ` [PATCH master 2/2] KASan: fix handling of devices with MMIO above SDRAM memory region Ahmad Fatoum
2022-12-13  8:37 ` [PATCH master 1/2] KASan: test_kasan: silence warning with newer GCC Sascha Hauer

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=20221212163907.2356192-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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