From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] i.MX: HABv4: Hide NULL pointers from optimizer
Date: Tue, 16 May 2023 10:22:00 +0200 [thread overview]
Message-ID: <20230516082200.1635283-1-s.hauer@pengutronix.de> (raw)
We are derefencing pointers which are in the zero page, consequently gcc
warns us with:
drivers/hab/habv4.c: In function 'imx6_hab_get_status':
drivers/hab/habv4.c:580:16: warning: array subscript 0 is outside array bounds of 'const struct habv4_rvt[0]' [-Warray-bounds]
Yes, we really want to derefence these pointers, so silence the warning
with OPTIMIZER_HIDE_VAR().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/hab/habv4.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 252e38f655..ca26773bf8 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -564,14 +564,17 @@ int imx6_hab_get_status(void)
const struct habv4_rvt *rvt;
rvt = (void *)HABV4_RVT_IMX6_OLD;
+ OPTIMIZER_HIDE_VAR(rvt);
if (rvt->header.tag == HAB_TAG_RVT)
return habv4_get_status(rvt);
rvt = (void *)HABV4_RVT_IMX6_NEW;
+ OPTIMIZER_HIDE_VAR(rvt);
if (rvt->header.tag == HAB_TAG_RVT)
return habv4_get_status(rvt);
rvt = (void *)HABV4_RVT_IMX6UL;
+ OPTIMIZER_HIDE_VAR(rvt);
if (rvt->header.tag == HAB_TAG_RVT)
return habv4_get_status(rvt);
--
2.39.2
reply other threads:[~2023-05-16 8:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230516082200.1635283-1-s.hauer@pengutronix.de \
--to=s.hauer@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