From 98f0812a9d4cc09e9b518722e117f34d9148f988 Mon Sep 17 00:00:00 2001 From: chash Date: Thu, 23 May 2024 17:15:54 +0100 Subject: [PATCH] Reduce scope of local var Also reduce the maximum size for helper function to 32 entries --- src/lkm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lkm.h b/src/lkm.h index 4d6f347..31d700a 100644 --- a/src/lkm.h +++ b/src/lkm.h @@ -203,12 +203,12 @@ static struct _kv_hide_ps_on_load kv_hide_ps_on_load[] = { * Helper that returns the list of names to hide on load */ static inline const char **kv_get_hide_ps_names(void) { - int i; - // XXX: using fixed maxsize kv_hide_ps_on_load now - static const char *names[256]; + // XXX: using fixed maxsize kv_hide_ps_on_load for now + static const char *names[32]; if (!*names) { - size_t maxnames = sizeof(names) / sizeof(names[0]); - for (i = 0; i < maxnames && kv_hide_ps_on_load[i].name != NULL; ++i) { + int i = 0; + size_t maxnames = sizeof(names) / sizeof(*names); + for (; i < maxnames && kv_hide_ps_on_load[i].name != NULL; ++i) { names[i] = kv_hide_ps_on_load[i].name; } }