From: "Tobin C. Harding" <me@tobin.cc>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Eric Anholt <eric@anholt.net>,
Stefan Wahren <stefan.wahren@i2se.com>
Cc: Tycho Andersen <tycho@tycho.ws>,
Kees Cook <keescook@chromium.org>,
kernel-hardening@lists.openwall.com,
driverdev-devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] staging: vchiq_arm: Clear VLA warning
Date: Fri, 9 Mar 2018 17:21:10 +1100 [thread overview]
Message-ID: <1520576470-20628-1-git-send-email-me@tobin.cc> (raw)
The kernel would like to have all stack VLA usage removed[1]. The
array here is fixed (declared with a const variable) but it appears
like VLA to the compiler. We can use a pre-processor define to quiet
the compiler.
[1]: https://lkml.org/lkml/2018/3/7/621
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
The name of this constant may need changing, there is already a
pre-processor constant VCHIQ_MAX_SERVICES
.../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index f5cefda49b22..c972869a0333 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -3434,13 +3434,15 @@ vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle)
return ret;
}
+/* Only dump 64 services */
+#define VCHIQ_LOCAL_MAX_SERVICES 64
+
void
vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
{
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
int i, j = 0;
- /* Only dump 64 services */
- static const int local_max_services = 64;
+
/* If there's more than 64 services, only dump ones with
* non-zero counts */
int only_nonzero = 0;
@@ -3455,7 +3457,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
int fourcc;
int clientid;
int use_count;
- } service_data[local_max_services];
+ } service_data[VCHIQ_LOCAL_MAX_SERVICES];
if (!arm_state)
return;
@@ -3466,10 +3468,10 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
peer_count = arm_state->peer_use_count;
vc_use_count = arm_state->videocore_use_count;
active_services = state->unused_service;
- if (active_services > local_max_services)
+ if (active_services > VCHIQ_LOCAL_MAX_SERVICES)
only_nonzero = 1;
- for (i = 0; (i < active_services) && (j < local_max_services); i++) {
+ for (i = 0; (i < active_services) && (j < VCHIQ_LOCAL_MAX_SERVICES); i++) {
VCHIQ_SERVICE_T *service_ptr = state->services[i];
if (!service_ptr)
@@ -3499,7 +3501,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
vchiq_log_warning(vchiq_susp_log_level, "Too many active "
"services (%d). Only dumping up to first %d services "
"with non-zero use-count", active_services,
- local_max_services);
+ VCHIQ_LOCAL_MAX_SERVICES);
for (i = 0; i < j; i++) {
vchiq_log_warning(vchiq_susp_log_level,
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next reply other threads:[~2018-03-09 6:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 6:21 Tobin C. Harding [this message]
2018-03-09 18:11 ` Eric Anholt
2018-03-09 18:35 ` Kees Cook
2018-03-09 18:44 ` Linus Torvalds
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=1520576470-20628-1-git-send-email-me@tobin.cc \
--to=me@tobin.cc \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=eric@anholt.net \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stefan.wahren@i2se.com \
--cc=tycho@tycho.ws \
/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
all inboxes | Powered by JetHome®